Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure移动应用脱机SQLite同步挂起初始化_C#_Sqlite_Win Universal App_Azure Mobile Services - Fatal编程技术网

C# Azure移动应用脱机SQLite同步挂起初始化

C# Azure移动应用脱机SQLite同步挂起初始化,c#,sqlite,win-universal-app,azure-mobile-services,C#,Sqlite,Win Universal App,Azure Mobile Services,我正在尝试创建一个通用Windows应用程序,它使用从Azure移动应用程序获取的数据的脱机副本 我已经创建了一个引用Microsoft.Azure.Mobile.Client.SQLiteStore和SQLite.Net.Async-PCL NuGet包的可移植项目 我有一个DataService类,它尝试使用以下代码初始化脱机数据库: if (!_dataSyncClient.SyncContext.IsInitialized) { _

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

我已经创建了一个引用Microsoft.Azure.Mobile.Client.SQLiteStore和SQLite.Net.Async-PCL NuGet包的可移植项目

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

if (!_dataSyncClient.SyncContext.IsInitialized)
            {
                _store = new MobileServiceSQLiteStore(AppConstants.SqliteDatabaseFile);
                _store.DefineTable<Language>();

                var syncCtx = _dataSyncClient.SyncContext;

                await syncCtx.InitializeAsync(_store);
            }
if(!\u dataSyncClient.SyncContext.IsInitialized)
{
_store=新的MobileServiceSQLiteStore(AppConstants.SqliteDatabaseFile);
_store.DefineTable();
var syncCtx=_dataSyncClient.SyncContext;
等待syncCtx.InitializeAsync(_存储);
}
但是当我试图从UWA调用这段代码时,它挂起在InitializeAsync方法上,没有异常,什么都没有。我注意到离线SQLite是用一个空的语言表和一些空的系统表(配置、错误、操作)创建的


UWA引用了Microsoft.Azure.Mobile.Client.SQLiteStore NuGet包和通用应用程序平台dll版本3.10.2.0的SQLite。移动应用程序SQLite存储类与SQLite.NET不兼容,因为它使用SQLitePCL。可能是您试图从这两个库访问同一个SQLite数据库,这导致了问题

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


有关基于内置
MobileServiceSQLiteStore
的工作示例,请参阅。该项目提供了有关如何添加脱机同步支持的说明。您需要添加并添加对的引用。

我想知道这是否与移动服务和移动应用程序之间的差异有关,我找到的大多数示例都是针对移动服务的。看起来代码不错-确保您使用的是最新的NuGet软件包(v2.0.x)对于Microsoft.Azure.Mobile.Client和Microsoft.Azure.Mobile.Client.SqliteStore谢谢,如果无法将SQLite.NET和移动应用SQLite应用商店合并,如何使用DropTable或某种事务操作?更新答案。您好,我正在尝试在Xamarin解决方案中将Microsoft.Azure.Mobile.Client.SQLiteStore nuget 3.0.3安装到UWP应用程序,但3+版本显然不兼容,因为我可以将其安装到portable project、iOS、Droid,但不能安装到UWP。