When working with real time enterprise apps, infrastructure plays a bigger role. With Microsoft Azure we can overcome this infrastructure problem. This is one aspect.
When we are working with a mobile application which is targetting all the platforms (iOS, Android and Windows) then data storage, push notifications, etc play a key role. Using Azure Mobile App Service this process is made simpler and can easily be hooked in to the application.
In this article we will be discussing about Easy Tables in Mobile App Service.
What are Easy Tables
Easy Tables are known for no code table and with out writing code one can create a backend table and are ODATA friendly.
Lets start in creating app service and configuring the easy tables for our application.
Goto Azure Portal (http://portal.azure.com) with your enterprise or personal account.
Click on Plus Sign which is used to create a new service.
Choose Web + Mobile and select Mobile App. Specify a name for the app and change the rest of the properties and click on Create.
Once the app service is create you can able to see that in all services section as above.
Click on the app service for details.
We can able to see App Service Editor which is browser based editor for the app service. This app is built over node.js.
Click on Advanced Tools to see the complete app specific information which shows all about the endpoints and developer oriented tools. This is called as Kudu. You can able to see the complete environment and endpoint details as below.
Scroll down and look for easy tables.
Click on Continue to create a table.
Click to create a new database or connect to an existing database.
Click on Plus Symbol to add a new Data connection (database).
Click on New Database and provide all the details.
Provide all the details and click on create.
Select to override the settings and click on Initialize.
You can see the app service code generated. We can go to this page by clicking on App Service Editor.
Once our database is created. Now we can add a table under that database. Click on Easy Tables and Choose add to create a new table and specify a name.
Once the table is created, it creates with default schema and we can manage schema and add the necessary fields to that.
You can able to see the default schema as below.
Click on Add Column to create new column. Note: here app service supports 4 data types - string, number, boolean, date.
Now we will start writing the mobile application. In this example I am targetting only iOS. If you are creating Xamarin Forms solution, the procedure is same but the code will be written in PCL.
As a generic process, create a new single view application. We need to add specific nuget packages for working with Mobile services.
Add the below code in AppDelegate.cs -> Finished Launching
Create a class names Azure Service. Initialize the following properties.
Create a method, Initialize to setup the client and local db.
We will be having methods for getting employees and inserting employee.
As mobile app services support offline synchronization we are specifying sync method in order to push and pull the latest changes.
Once you insert the employees, you can able to see the details in Azure portal -> Easy tables as below.
This is just a basic example to get started with. You can know more about App Service here Azure App Service