How to clear sqlite database upon logout

I use Xamarin Forms and WindowsAzure.MobileServices.SQLiteStore NuGet to handle synchronization between my sqlite database and my azure database. Everything works fine, but when I want to log out of my user, I want to clear the database. Thus, at the next login, it will restore the database again and synchronize from scratch. I tried to clear the tables, but that only deletes local data, and when you log in, it will only sync any new data.

Currently, my order does the following:

// Globally declared and initialized in my init() method
MobileServiceSQLiteStore store { get; set; }
public MobileServiceClient MobileService { get; set; }

public async Task Dispose()
{
    try
    {
        initialized = false;

        // await this.userTable.PurgeAsync<AzureUser>("CleanUsers", this.userTable.CreateQuery(), CancellationToken.None);

        store.Dispose();
        MobileService.Dispose();

        store = null;
        MobileService = null;
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

Any idea how I can clear the sqlite database upon logout using this component? Thank!

+4
1

, :

this.userTable.PurgeAsync(null, null, true, CancellationToken.None);

. .

+4

All Articles