Azure Mobile Services - Notes of Soft Delete feature


How to use Soft Delete feature: http://azure.microsoft.com/en-us/documentation/articles/mobile-services-using-soft-delete/

Some of the potential benefits of using soft delete:

    • When using the Offline data Sync for Mobile Services feature, the client SDK automatically queries for deleted records and removes them from the local database. Without soft delete enabled, you need to write additional code on the backend so that the client SDK knows which records to remove from the local store. Otherwise, the client local store and backend will be inconsistent with regard to these deleted records and the client methodPurgeAsync() must be called to clear the local store.
    • Some applications have a business requirement to never physically delete data, or to delete data only after it has been audited. The soft delete feature can be useful in this scenario.
    • Soft delete can be used to implement an "undelete" feature, so that data deleted by accident can be recovered. However, soft deleted records take up space in the database, so you should consider creating a scheduled job to periodically hard delete the soft deleted records. For an example of this, see [Using soft delete with the .NET backend] and [Using soft delete with the JavaScript backend]. Your client code should also periodically callPurgeAsync() so that these hard deleted records do not remain in the device's local data store.

Notes:  

Soft Delete only works with tables have id of type of "string", otherwise 

1. the records will be permantely deleted on calling the delete method from the Mobile Service Client SDK 

2. and you'll see an error like "xxx has an integer id member and therefore can not have any members with the system property attribute 'Deleted' " if you add [Deleted] attribute on your mobile app local model when syncing offline data with mobile services.

3. With a table with soft delete (id is type of string and has __deleted (bit) column) enabled, we tried disable soft delete by deleting the __deleted field, but found the query against the table won't work, after added the __deleted back. the query works again




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值