Updating from Microsoft.Azure.Mobile.Client to Microsoft.Datasync.Client

E. A. Bagby 20 Reputation points
2023-06-14T18:16:04.7633333+00:00

I found this post that is very similar to our existing code, except this appears to be a more standard, generic version from an example by Montenegro. For that reason, I'm using the code from the link in this post.

https://learn.microsoft.com/en-us/answers/questions/589124/error-on-client-synccontext-initializeasync(store)

We are attempting to upgrade the code, which is based on Microsoft.Azure.Mobile.Client, to Microsoft.Datasync.Client for our WebJob application.

Because of the differences in the references, translating from one to the other is proving difficult, even after studying https://learn.microsoft.com/en-us/azure/developer/mobile-apps/azure-mobile-apps/howto/client/dotnet#setup-and-prerequisites

What would be immensely helpful is a generic example that translates the code below into a Microsoft.Datasync.Client example. Thank you!

public async Task Initialize()
        {
            if (Client?.SyncContext?.IsInitialized ?? false)
                return;

            var appUrl = "https://mymobileapp.azurewebsites.net";


            Client = new MobileServiceClient(appUrl);


            var path = "mymobileapp.db";
            path = Path.Combine(MobileServiceClient.DefaultDatabasePath, path);


            var store = new MobileServiceSQLiteStore(path);

            store.DefineTable
Community Center | Not monitored
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.