我目前面临这样一个问题:我正在构建一个使用 Xamarin 和 Azure App Service Mobile App 作为云后端的应用程序。问题是,如果我从 Azure 中托管的 DB 中的相应表中删除一些数据,移动设备上的下一个 PullAsync 调用将失败,因为它试图请求删除的记录。有什么方法可以同步删除首先在 Azure DB 中发生然后被拉到设备的记录?
另一种方式运行顺利:如果我从设备中删除记录,则相应的记录将在 Azure DB 中删除。
我目前面临这样一个问题:我正在构建一个使用 Xamarin 和 Azure App Service Mobile App 作为云后端的应用程序。问题是,如果我从 Azure 中托管的 DB 中的相应表中删除一些数据,移动设备上的下一个 PullAsync 调用将失败,因为它试图请求删除的记录。有什么方法可以同步删除首先在 Azure DB 中发生然后被拉到设备的记录?
另一种方式运行顺利:如果我从设备中删除记录,则相应的记录将在 Azure DB 中删除。
TableController
您必须通过在您的服务器上为您需要的每个位置启用软删除来使用软删除。此处为TodoItem
TableController
.
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
MobileServiceContext context = new MobileServiceContext();
DomainManager = new EntityDomainManager<TodoItem>(context, Request, enableSoftDelete: true);
}
更多信息在这里。