dimanche 1 mai 2016

Azure Mobile App Offline Sync never got data

I'm creating Windows 10 Store application and I have a problem when calling PullAsync method. I was using Azure Mobile App for a long time and I always used private IMobileServiceTable<MyTable> table. Now, I need to add support of something in Microsoft called Offline Sync. Following instruction, I didn't succeeded.

Here's my code.

using Microsoft.WindowsAzure.MobileServices;
using Microsoft.WindowsAzure.MobileServices.Sync;
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;

private IMobileServiceSyncTable<MyTable> OffTable = App.MobileService.GetSyncTable<MyTable>();
private IMobileServiceTable<MyTable> OnTable = App.MobileService.GetTable<MyTable>();

protected ovveride async OnNavigatedTo()
        var store = new MobileServiceSQLiteStore("localstore.db");

        await App.MobileService.SyncContext.InitializeAsync(store);

    await OffTable.PullAsync("uniqueID", OffTable.CreateQuery());
    var data = await OffTable.ToCollectionAsync();    //return -> nothing

    var data2 = await OnTable.ToCollectionAsync();    //return -> 50 rows

And MyTable.cs

using Microsoft.WindowsAzure.MobileServices;
using Newtosoft.Json;

public sealed class MyTable
    public int ID { get; set;}

    public string Field1 { get; set; }


    [JsonProperty(PropertyName = "version")]
    public string Version { get; set; }

    [JsonProperty(PropertyName = "deleted")]
    public bool Deleted { get; set; }

    [JsonProperty(PropertyName = "updatedAt")]
    public DateTime UpdatedAt { get; set; }

    [JsonProperty(PropertyName = "createdAt")]
    public DateTime CreatedAt { get; set; }

Here's values from project.json:

"Microsoft.Azure.Mobile.Client": "2.0.1",
"Microsoft.Azure.Mobile.Client.SQLiteStore": "2.0.1"

What I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire