Azure Mobile App脱机SQLite同步挂起初始化

时间:2016-03-18 13:28:23

标签: c# sqlite win-universal-app azure-mobile-services

我正在尝试创建一个通用Windows应用程序,该应用程序使用从Azure移动应用程序获取的数据的脱机副本。

我创建了一个引用Microsoft.Azure.Mobile.Client.SQLiteStore和SQLite.Net.Async-PCL NuGet包的Portable项目。

我有一个DataService类,它尝试使用以下代码初始化脱机数据库:

{
    "apiVersion": "2015-08-01",
    "type": "hostNameBindings",
    "name": "www.yourcustomdomain.com",
    "dependsOn": [
        "[concat('Microsoft.Web/sites/', variables('webAppName'))]"
    ],
    "properties": {
        "domainId": null,
        "hostNameType": "Verified",
        "siteName": "variables('webAppName')"
    }
}

但是当我尝试从UWA调用此代码时,它会挂起InitializeAsync方法,没有例外,没有。有一件事我注意到使用空的语言表和一些空的系统表(__config,__ erros,__ operation)创建了离线SQLite。

UWA引用了Microsoft.Azure.Mobile.Client.SQLiteStore NuGet包,并引用了SQLite for Universal App Platform dll版本3.10.2.0。

1 个答案:

答案 0 :(得分:2)

Mobile Apps SQLite商店类与SQLite.NET兼容,因为它使用SQLitePCL。您可能尝试从两个库访问相同的SQLite数据库并导致问题。

如果SQLite.NET支持很重要,您可以使用我们的作为起点编写本地商店实现:Mobile Apps SQLiteStore on GitHub。该设计足够灵活,可以替代任何本地商店实施。

对于基于内置MobileServiceSQLiteStore的工作示例,请参阅https://github.com/Azure/azure-mobile-apps-quickstarts/tree/master/client/windows-uwp-cs。该项目提供了有关如何添加脱机同步支持的说明。您需要添加UWP SQLite VSIX package并添加对Microsoft.Azure.Mobile.Client.SQLiteStore的引用。