Azure Mobile App Offline SQLite Sync 在初始化时挂起
Azure Mobile App Offline SQLite Sync hanging on Initialize
我正在尝试创建一个通用 Windows 应用程序,该应用程序使用从 Azure 移动应用程序获取的数据的离线副本。
我创建了一个引用 Microsoft.Azure.Mobile.Client.SQLiteStore 和 SQLite.Net.Async-PCL NuGet 包的 Portable 项目。
我有一个 DataService class 尝试使用以下代码初始化离线数据库:
if (!_dataSyncClient.SyncContext.IsInitialized)
{
_store = new MobileServiceSQLiteStore(AppConstants.SqliteDatabaseFile);
_store.DefineTable<Language>();
var syncCtx = _dataSyncClient.SyncContext;
await syncCtx.InitializeAsync(_store);
}
但是当我尝试从 UWA 调用此代码时,它挂在 InitializeAsync 方法上,没有异常,没有任何问题。我注意到一件事,离线 SQLite 是用空语言 table 和一些空系统 tables(__config、__erros、__operations)创建的。
UWA 引用了 Microsoft.Azure.Mobile.Client.SQLiteStore NuGet 包和 SQLite for Universal App Platform dll 版本 3.10.2.0。
移动应用程序 SQLite 商店 class 不 与 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. The project has instructions for how to add offline sync support. You need to add the UWP SQLite VSIX package and add a reference to Microsoft.Azure.Mobile.Client.SQLiteStore。
我正在尝试创建一个通用 Windows 应用程序,该应用程序使用从 Azure 移动应用程序获取的数据的离线副本。
我创建了一个引用 Microsoft.Azure.Mobile.Client.SQLiteStore 和 SQLite.Net.Async-PCL NuGet 包的 Portable 项目。
我有一个 DataService class 尝试使用以下代码初始化离线数据库:
if (!_dataSyncClient.SyncContext.IsInitialized)
{
_store = new MobileServiceSQLiteStore(AppConstants.SqliteDatabaseFile);
_store.DefineTable<Language>();
var syncCtx = _dataSyncClient.SyncContext;
await syncCtx.InitializeAsync(_store);
}
但是当我尝试从 UWA 调用此代码时,它挂在 InitializeAsync 方法上,没有异常,没有任何问题。我注意到一件事,离线 SQLite 是用空语言 table 和一些空系统 tables(__config、__erros、__operations)创建的。
UWA 引用了 Microsoft.Azure.Mobile.Client.SQLiteStore NuGet 包和 SQLite for Universal App Platform dll 版本 3.10.2.0。
移动应用程序 SQLite 商店 class 不 与 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. The project has instructions for how to add offline sync support. You need to add the UWP SQLite VSIX package and add a reference to Microsoft.Azure.Mobile.Client.SQLiteStore。