Reputation: 930
I'm migrating code from an ASP.NET application to a desktop WinUI3 applications that uses Azure and creates an SQLite database (from a database stored on Azure) for mobile use.
The problem I'm having is that the essential namespaces of the ASP.NET application, which isn't very old, are deprecated per https://learn.microsoft.com/en-us/dotnet/api/overview/azure/mobile-services?view=azure-dotnet. They include:
WindowsAzure.MobileServices
WindowsAzure.MobileServices.SQLiteStore
Here's a small excerpt of code in case it's helpful to give the idea:
...
// Create mobile service client
MobileServiceClient MobileService = new MobileServiceClient(aimWebUtilityUrl, new AddHeadersHandler(httpHeaders))
{
SerializerSettings = new MobileServiceJsonSerializerSettings()
{
CamelCasePropertyNames = false,
DateTimeZoneHandling = DateTimeZoneHandling.Local
}
};
// Set path of database file
string DbFile = Path.Combine(MobileServiceClient.DefaultDatabasePath, databaseName + "_" + Guid.NewGuid() + ".db");
try
{
// Clean existing database files from server
CleanDatabaseFilesFromServer();
// Create database file
File.WriteAllBytes(DbFile, new byte[0]);
}
catch (Exception ex)
{
Console.WriteLine("Exception in " + message + " database deletion: " + ex.Message);
}
var store = new MobileServiceSQLiteStore(DbFile);
...
I've searched the documentation and the NuGet package manager but cannot seem to find any information on equivalent packages that would allow me to replicate the code.
Any information on upgrading the namespaces for the WinUI3 application is appreciated.
Upvotes: 0
Views: 178
Reputation: 8035
The libraries you mentioned implement v2 of the protocol. The latest libraries implement v3 of the protocol, but the server is somewhat backwards compatible with the v2 client (there are provisos here - most notably, you can't send substring searches to the server).
If you are creating a new client (WinUI3), then you can keep the old database and create a new server (ASP.NET Core) that references the same tables. You will have to re-implement authentication, authorization, and anything else that you did to the table controllers on your v2 server. There is a sample in the docs. This will allow you to support both older and newer clients from the same database.
New Github repo (with sample code and the full source to the SDK) is at https://github.com/azure/azure-mobile-apps. We have issues and discussions open there.
And, as mentioned above, https://learn.microsoft.com/en-us/azure/developer/mobile-apps/azure-mobile-apps/quickstarts/winui/ is the link to the tutorial and provides links to the HOW TO on both server and client.
(Source: I am the current maintainer of Azure Mobile Apps)
Upvotes: 0