Azure not saving records

Seth Isaacks 11 Reputation points
2021-03-12T05:03:15.39+00:00

I am not sure what is really going on. I followed the example in this tutorial and the tables were created on Azure....but the data does not seem to save there. It saves locally though. I cannot figure out why the data is not saving on the server.
I have follwed every tutorial to the "T" but I cannot get data to save to Azure.
I am coping in my code for the client below.

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

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

        client = new MobileServiceClient(appUrl);

        var fileName = "MyDB.db";

        var store = new MobileServiceSQLiteStore(fileName);

        store.DefineTable<MyTable>();


        await client.SyncContext.InitializeAsync(store);

        appSettingsTable = client.GetSyncTable<MyTable>();

    }

public async Task SyncMyTable()
{
await Initialize();
try
{
if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
{
return;
}

            await client.SyncContext.PushAsync();
            await rifleTable.PullAsync("allRifles", rifleTable.CreateQuery().Where(x => x.UserId == App.UserId));
        }
        catch (Exception ex)
        {
            App.logger.Error(ex.ToString());
        }
    }

public async Task<List<MyTable>> GetMyTable()
{
await Initialize();
await SyncMyTable);

        var myTable= (await myTable.Where(x => x.UserId == App.UserId).ToListAsync());
        return myTable?? new List<MyTable>();
    }
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,234 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,863 questions
{count} votes