1
在我的Xamarin iOS PCL應用程序中,我嘗試將記錄插入到本地Sqlite表中,通過Azure移動服務同步,然後再讀回。 下面是代碼:如何使用Azure移動服務正確同步Xamarin iOS Sqlite
private IMobileServiceSyncTable<Job> jobTable;
public async Task InitializeAsync()
{
var store = new MobileServiceSQLiteStore("localdata.db");
store.DefineTable<Job>();
await this.MobileService.SyncContext.InitializeAsync(store);
jobTable = this.MobileService.GetSyncTable<Job>();
jobTable = this.MobileService.GetSyncTable<Job>();
JObject newJob = new JObject();
newJob.Add ("Id","job_123");
jobTable.InsertAsync (newJob);
this.MobileService.SyncContext.PushAsync();
var readResult = jobTable.ReadAsync().Result.AsQueryable();
var resultList = from data in readResult
select data;
var resultCount = resultList.Count();
}
到目前爲止 - 沒有獲取同步了我的SQL Server數據庫(這是對移動服務的recieving結束),以及RESULTCOUNT個保持在0
我我確定我在這裏做錯了什麼,只是似乎無法確定究竟是什麼。
-Eugene