Page 35 - MSDN Magazine, June 2017
P. 35
At the time of this writing, Mobile Center only supports iOS and Android applications (support for Windows is planned), and the list of available development plat- forms varies depending on the OS of your choice. Enter the informa- tion as shown in Figure 1, making sure you select Xamarin, and click Add new app. Feel free to select iOS instead of Android if you have a Mac computer that you can use to build Xamarin projects, as the sam- ple code will run on both. Also, you can associate an app twice in order to enable the support for analytics and crash reports on both OSes.
After this, the Visual Studio Mobile Center shows how to include analytics and crash reports in a Xamarin app (including Xamarin.Forms) using the Mobile Center SDK NuGet packages. This will be done later in the sample code, so let’s move forward.
Creating Tables
You’ll now set up a new table to store a list of books, so click Tables in the toolbar. Because Mobile Center relies on the Azure platform for identity and tables, you’ll be asked to connect your Azure subscrip- tion with the Connect Subscription button. Once the subscription has been connected, you’ll be able to click Create Table to get started. At this point, Visual Studio Mobile Center creates a new mobile app back end and an app endpoint in the Azure Mobile Apps service. See the endpoint form at https://mobile- {your-app-id}.azurewebsites.net/.
Figure 1 Adding an App to Visual Studio Mobile Center
• Dynamic schema lets you dynamically create new columns on the client instead of the server when new objects are inserted. This is beneficial during development, but a security problem during production usage, so it should be avoided when the app graduates to production.
• Per-user data adds a user column to the table and lets you filter data based on the current user information. Selecting this option makes sense when authentication is enabled.
In the popup that appears, enter Book as the new table name. Then, select Authenticated, Soft delete and Per-user data checkboxes and unse- lect Dynamic schema. The following is a brief description of each option:
• Authenticated lets you restrict access to the table to only authenticated users. Anonymous access is granted when this option is not selected.
• Soft delete lets you mark records as deleted instead of removing them from the database. This gives you an option to undelete records. Queries can be filtered to return only active records.
Figure 2 The Schema of a New Table, Including System Columns
msdnmagazine.com
June 2017 31