2
votes

How can I share data between an instance of an MVC Web App and an Mobile App client say Android.

From the App Service documentation it is stated that we can use "(For .NET) Leverage any feature of ASP.NET, including MVC"

Following the standard Azure Todo List tutorial, if I create an Azure App Service, add and publish an Android Client with the Todo List object. If I want to add another object say Student.cs that should be shared between an MVC Web app and the Android client.

  1. Do I need to extend Student.cs from EntityData and scaffold an MVC controller using the default TodoContext. If this is the option should I use migration to update the App Service DB? Just publishing this back to App Service did not work for me.
  2. Do I need to create a new MVC app, and scaffold CRUD operations directly against the Azure SQL database used by the App Service? If this option how can the App service be notified of data changes?
  3. Do I need to publish the MVC web as a Web API and bye pass the Mobile App client SDK and instead call the API app directly from my mobile client?

The goal is to do data entry in the web app and pull and display the data in the mobile app.

1

1 Answers

2
votes

You can combine the Azure Mobile App and Azure Web App into one single entity. Your application has access to the OData v3 endpoints as https://{yoursite}.azurewebsites.net/table/{your-table} and your application can do regular AJAX REST calls from the client. In addition, Entity Framework is fully set up so you can access the tables directly using Entity Framework.

So, set up your entities with a base class on EntityData, then use those with Entity Framework as normal. Scaffold your mobile web API using the Azure Mobile Apps SDK TableController.