如何爲從IMobileServiceSyncTable<T>.PullAsync()
方法返回的數據分頁?如何處理使用IMobileServiceSyncTable和Azure移動服務的分頁
我試着做這樣的事情,但它不工作我沒有料到:
myTable
是IMobileServiceTable<T>
mySyncTable
是一個IMobileServiceSyncTable<T>
// Already tracking how many records exist
// Note* Not using the sync table here, because that was not getting the correct results.
// It seemed more correct to use the regular table so it was "live" data.
var totalCount = myTable.Take(0).IncludeTotalCount().ToListAsync();
// Try and sync a "page" of data, limited by the values here
var query = mySyncTable.Skip(count).Take(maxPerPage);
await mySyncTable.PullAsync(null, query);
// At this point, I expect the local store to have a set of data
// So I try and get that "page" of data
var results = await mySyncTable.ReadAsync(query);
// That returns 0 results, so I tried
var results = await mySyncTable.Skip(count).Take(maxPerPage).ToEnumerableAsync();
// Still 0 results, so just give me all the things
var results = await mySyncTable.ToEnumerableAsync();
// Still 0...
我越來越totalCount
大於0,但是當我認爲我正在從本地商店閱讀時,我似乎無法通過跳過並取得結果。請建議如何正確分頁來自同步表的數據。
感謝您的回覆。我找到了這些文檔,這是我獲得基本實施的地方。但是,這並不是專門針對「SyncTable」,這是我的困惑即將到來的地方。如果我不使用SyncTable,而只是使用IMobileServiceTable,它將按預期工作。問題是使用同步表,並分頁同步/本地讀取。 – therealjohn