如果删除数据,Azure 应用服务移动应用数据库同步失败

Azure App Service Mobile App database synchronization failes if data is deleted

我目前正面临这样的问题:我正在使用 Xamarin 和 Azure App Service 移动应用程序构建一个应用程序作为云后端。问题是,如果我从 Azure 中托管的数据库中相应的 table 中删除一些数据,移动设备上的下一个 PullAsync 调用将失败,因为它会尝试请求已删除的记录。有什么方法可以同步删除首先在 Azure 数据库中发生然后被拉到设备的记录?

另一种方法很顺利:如果我从设备中删除记录,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);
}

更多信息here