azure - using MobileService.GetSyncTable PullAsync Trouble -
i trying using azure backend sync work app. looks pullasync not populating local table though.
my table set this:
private imobileservicesynctable<familie> familientable = app.mobileservice.getsynctable<familie>(); // offline sync
some code first. initializing table this:
if (!app.mobileservice.synccontext.isinitialized) { var store = new mobileservicesqlitestore("localgarden.db"); store.definetable<familie>(); await app.mobileservice.synccontext.initializeasync(store); }
i can see table created , on local system later (already tried setting new table, too).
and little later in code called:
try { await familientable.pullasync(null, familientable.createquery()); } catch (exception ex) { errorstring = "pull failed: " + ex.message + "\n\nif still in offline scenario, " + "you can try pull again when connected mobile serice."; } if (errorstring != null) { messagedialog d = new messagedialog(errorstring); await d.showasync(); }
i set based on https://azure.microsoft.com/en-us/documentation/articles/mobile-services-xamarin-ios-get-started-offline-data/ , adapted using win10 app. using microsoft.azure.mobile.client.sqlitestore 2.0.1 mainly.
i know need replace null in pullasync string incremental updates in future.
using fiddler discovered there 2 calls node.js powered api on azure during pullasync: [removed].azurewebsites.net/tables/familie?$skip=0&$top=50&__includedeleted=true (which returns json 6 rows have in table) , immidiatly after [removed].azurewebsites.net/tables/familie?$skip=6&$top=50&__includedeleted=true returns empty json.
my local table stays empty though.
can tell me, if behavior design, explain why 2 calls , give me idea reason why local table not populated?
thank much!
additional info: output of logginghandler:
create table if not exists [familie] ([id] integer primary key, [name] text, [deleted] boolean, [version] datetime, [createdat] datetime, [updatedat] datetime) create table if not exists [__operations] ([id] text primary key, [kind] integer, [state] integer, [tablename] text, [tablekind] integer, [itemid] text, [item] text, [createdat] datetime, [sequence] integer, [version] integer) create table if not exists [__errors] ([id] text primary key, [httpstatus] integer, [operationversion] integer, [operationkind] integer, [tablename] text, [tablekind] integer, [item] text, [rawresult] text) create table if not exists [__config] ([id] text primary key, [value] text) begin transaction insert or ignore [__config] ([id]) values (@p0) thread 0x2fcc has exited code 0 (0x0). update [__config] set [value] = @p0 [id] = @p1 commit transaction select * [__operations] order [sequence] desc limit 1 select count(1) [count] [__operations] pulling changes remote server 'gemüsebeetplaner.exe' (coreclr: coreclr_uwp_domain): loaded 'c:\users\jens\documents\visual studio 14\projects\gemüsebeetplaner\gemüsebeetplaner\bin\x86\debug\appx\system.linq.queryable.dll'. skipped loading symbols. module optimized , debugger option 'just code' enabled. select * [__operations] ([tablename] = @p1) limit 0 select count(1) [count] [__operations] ([tablename] = @p1) pulling changes remote server select * [__operations] ([tablename] = @p1) limit 0 select count(1) [count] [__operations] ([tablename] = @p1) select * [familie] order [name]
additonal info 2:
**screenshots of tables ** screenshot
this log parameters enabled: pulling changes remote server
select * [__operations] ([tablename] = @p1) limit 0 @p1:familie select count(1) [count] [__operations] ([tablename] = @p1) @p1:familie { "count": 0 } pulling changes remote server select * [__operations] ([tablename] = @p1) limit 0 @p1:familie select count(1) [count] [__operations] ([tablename] = @p1) @p1:familie { "count": 0 } select * [familie] order [name] thread 0x24c8 has exited code 0 (0x0). thread 0x1474 has exited code 0 (0x0). thread 0x1a40 has exited code 0 (0x0).
class
public class familie { [jsonproperty(propertyname = "id")] public int id { get; set; } [jsonproperty(propertyname = "name")] public string name { get; set; } }
there @ least 2 calls when doing pull operation, because client has no way of knowing server batch size. in example, server sent 6 records, client needs query find out if there more records
what symptom of local table not being populated? empty results when query of familientable
?
does first call return results? if so, there must strange in how local database being populated. try adding logging sqlite store app, log local database statements, here's sample: https://github.com/azure-samples/app-service-mobile-dotnet-todo-list-files/blob/master/src/client/mobileappsfilessample/helpers/logginghandler.cs
Comments
Post a Comment