【发布时间】:2015-12-17 13:34:14
【问题描述】:
所以我有一个名为Profile 的远程表,它已经创建了多个条目。现在我正在尝试将离线功能集成到我的应用程序中。截至目前,我的代码中的 PushAsync 和 PullAsync 方法存在问题。
我希望能够通过调用PullAsync 将远程表中的所有数据复制到本地表中,尽管它不会引发任何异常,但它也不会填充我的表。这是我的意思的一个例子。
var db = new SQLiteConnection("syncstoreTEMP.db");
var store = new MobileServiceSQLiteStore("syncstoreTEMP.db");
store.DefineTable<Profile>();
MobileService.SyncContext.InitializeAsync(store).Wait();
var remoteValues = MobileService.GetTable<Profile>()
.ToListAsync()
.Result;
MobileService.GetSyncTable<Profile>()
.PullAsync(null, MobileService.GetSyncTable<Profile>().CreateQuery())
.Wait();
var localValues = MobileService.GetSyncTable<Profile>()
.ToListAsync()
.Result;
当我运行此代码时,remoteValues 的总长度为 5,但即使从远程发出 Pull,localValues 仍显示 0 个条目。如何让同步表与我的远程表匹配?
【问题讨论】:
标签: c# sqlite azure xamarin azure-mobile-services