Reputation: 3780
I'm building a Xamarin mobile app, which offline-syncs using Azure Mobile App service.
A. Xamarin (mobile client):
Xamarin's docs show how to build an app and a local database (using the sqlite-net
ORM). Models are annotated with various attributes.
B. Azure Mobile App service (server):
Azure's docs show how to define models in the mobile app (without sqlite-net), and define similar models on the server app (using a customised Entity Framework). The client models use different attributes, and the server models don't use any attributes and derive from EntityData
.
But then the client has two databases - the "real" one (A), and the one from the Azure APIs (B).
Am I supposed to only implement (B)?
Which means, (A) is only if I want a local database, and I don't need the sqlite-net
ORM at all?
Upvotes: 2
Views: 581
Reputation: 3875
If you're using Offline Data Sync in Azure Mobile Apps, then you shouldn't do A, since the local database is already created for you as part of the offline sync feature. You do B as part of the C# ASP.NET server programming model, or you can use Easy Tables with a Node.js backend.
If you don't want a cloud connected app at all and the data to be stored only locally (i.e., no offline sync with a service), then do A only.
Alternatively, if you want the ORM provided by sqlite-net
(rather than just basic querying and CRUD in the Azure Mobile client SDK), you can define a custom local store based on sqlite-net
. To do this, create an implementation of IMobileServiceLocalStore. The Mobile Apps client SDK is open source, so you can use MobileServiceSQLiteStore as a starting point.
Upvotes: 3