Top Banner
Pierce Boggan @pierceboggan @bostonmobiledev Powerful Backends with Microsoft Azure
36

Powerful Backends with Microsoft Azure

Jan 20, 2017

Download

Software

Pierce Boggan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Powerful Backends with Microsoft Azure

Pierce Boggan@pierceboggan@bostonmobiledev

Powerful Backends with Microsoft Azure

Page 2: Powerful Backends with Microsoft Azure

Plenty of OptionsAmazon Web Services

Azure Mobile Apps

IBM MobileFirst

Oracle Mobile Cloud

SQLCIipher

Couchbase

MySQL

SQLite-net

soundcloud.com/xamarin-podcast

Page 3: Powerful Backends with Microsoft Azure

• Extremely powerful• Flexible• Easy Tables• App Service

• C# clients, written by C# developers

Why Azure?

Page 4: Powerful Backends with Microsoft Azure

REST

API

Offline sync Push Notifications

Data connections

User Authentication

Facebook

Twitter Microsoft Google

Azure Active

Directory

Azure Mobile Apps

WindowsAndroid

Chrome

iOS OSX

In-AppKindle

Xamarin & Windows SDKs

Backend code

SQL MongoTables O365 API Apps

Offline Sync

Page 5: Powerful Backends with Microsoft Azure

Introducing Azure Mobile Apps

Page 6: Powerful Backends with Microsoft Azure

Xamarin Platform: native apps across platforms

Page 7: Powerful Backends with Microsoft Azure

Xamarin’s Unique Approach

Shared C# codebase • 100% native API access • High performance

iOS C# UI

Windows C# UIAndroid C# UI

Shared C# Mobile

C# Server

Linux/MonoCoreCLRAzure

Shared C# Client/Server

Page 8: Powerful Backends with Microsoft Azure

Visual Studio Xamarin Studio

Page 9: Powerful Backends with Microsoft Azure

Build native UIs for iOS, Android, and Windows Phone from a single, shared C# codebase.

Meet Xamarin.Forms

Page 10: Powerful Backends with Microsoft Azure

Xamarin + Xamarin.Forms

Traditional Xamarin Approach

With Xamarin.Forms:More code-sharing, all

native

iOS C# UI Windows C#

UIAndroid C# UI

Shared C# Backend

Shared UI Code

Shared C# Backend

Page 11: Powerful Backends with Microsoft Azure

What’s included

✓ 40+ Pages, layouts, and controls (Build from code behind or XAML)✓ Two-way data binding✓ Navigation✓ Animation API✓ Dependency Service✓ Messaging Center

Shared C# Backend

Shared UI Code

Page 12: Powerful Backends with Microsoft Azure

<?xml version="1.0" encoding="UTF-8"?><TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.MainPage"><TabbedPage.Children><ContentPage Title="Profile" Icon="Profile.png"> <StackLayout Spacing="20" Padding="20" VerticalOptions="Center"> <Entry Placeholder="Username" Text="{Binding Username}"/> <Entry Placeholder="Password" Text="{Binding Password}" IsPassword="true"/> <Button Text="Login" TextColor="White" BackgroundColor="#77D065" Command="{Binding LoginCommand}"/> </StackLayout></ContentPage><ContentPage Title="Settings" Icon="Settings.png"> <!-- Settings --></ContentPage></TabbedPage.Children>

Native UI from shared code

Page 13: Powerful Backends with Microsoft Azure

Windows Xamarin.FormsStackPanel StackLayoutTextBox EntryListBox ListViewCheckBox SwitchProgressBar ActivityIndicatorGrid GridLabel LabelButton ButtonImage ImageDate/TimePicker Date/TimePicker

Control Comparison

Page 14: Powerful Backends with Microsoft Azure

Windows Xamarin.FormsDataContext BindingContext{Binding Property}

{Binding Property}

ItemsSource ItemsSourceItemTemplate ItemTemplateDataTemplate DataTemplate

BindingComparison

Page 15: Powerful Backends with Microsoft Azure

Azure Easy Tables

Page 16: Powerful Backends with Microsoft Azure

Azure is super powerful. But what if you just need a simple data store?

Page 17: Powerful Backends with Microsoft Azure

• Add a backend to your mobile app in as little as 15 minutes!

• Great for simple data storage / authentication / push capabilities

• Just like “old Azure Mobile Services” / Parse• Features• No-code CRUD backend• Create schema yourself• View app data

Azure Easy Tables

Page 18: Powerful Backends with Microsoft Azure

• Very limited control over how your backend operates – how data is stored, etc.

• End up having to move more logic to frontend than is ideal.

• Examples• GetAll should only return items for a particular user – very difficult to

do.• Trigger a push notification when an item is added to the a table

Azure Easy Tables - Tradeoffs

Page 19: Powerful Backends with Microsoft Azure

• Improve app responsiveness by caching server data locally on the device

• Make apps resilient against intermittent network connectivity.

• Allow end-users to create and modify data even when there is no network access, supporting scenarios with little or no connectivity.

• Sync data across multiple devices and detect conflicts when the same record is modified by two devices.

Offline Sync

Page 20: Powerful Backends with Microsoft Azure

Create a MobileServiceMobileService = new MobileServiceClient(

"https://myapp.azurewebsites.net);

Page 21: Powerful Backends with Microsoft Azure

Create TablesIMobileServiceSyncTable<Todo> table;public async Task Init(){ const string path = "syncstore.db"; var db = new MobileServiceSQLiteStore(path); db.DefineTable<Todo>();

}

var handler = new MobileServiceSyncHandler(); await MobileService.SyncContext.InitializeAsync(db, h); table = MobileService.GetSyncTable<Todo>();

Page 22: Powerful Backends with Microsoft Azure

Get and Modify Datapublic async Task<IEnumerable<Store>> GetStoresAsync(){ await table.PullAsync("allStores", table.CreateQuery()); return await table.ToEnumerableAsync();}public async Task<Store> AddStoreAsync (Store store){ await table.InsertAsync (store); await table.PullAsync("allStores", table.CreateQuery()); await MobileService.SyncContext.PushAsync(); return store;}

Page 23: Powerful Backends with Microsoft Azure

Let’s build an app!

Page 24: Powerful Backends with Microsoft Azure

• “App Service is a cloud platform to build powerful web and mobile apps that connect to data anywhere, in the cloud or on-premises”

• Easy Tables with more control.• Migrate from Easy Tables to App Service without any frontend changes.

• Stack: ASP.NET Web API + OData + Entity Framework

Azure App Service

Page 25: Powerful Backends with Microsoft Azure

• Full control over how your data is stored and retrieved

• Built-in autoscale, load balancing, and performance monitoring

• Add continuous running logic with WebJobs• Connect your mobile app to SaaS APIs, like

Office 365, SharePoint, and SAP• Access on-prem data with hybrid

connections with a VPN

Why Azure App Service?

Page 26: Powerful Backends with Microsoft Azure

• Rolling your own account infrastructure is difficult and time-consuming

• Secure your app with prebuilt authentication providers• Facebook• Twitter• Google• Microsoft• Azure AD• Anything OAuth 2

Authentication

Page 27: Powerful Backends with Microsoft Azure

• Easy-to-use, multiplatform scaled push infrastructure that allows you to send push notifications almost anywhere.

Push Notifications

Page 28: Powerful Backends with Microsoft Azure

• Sync files to Azure Storage, just like you did for structured data.

File Sync

Page 29: Powerful Backends with Microsoft Azure

Connect with your Consumers• Consumer Application• Browse Stores & Details• Call & Navigate to Store• Easily Send Feedback

• Rich Native Interface• 100% Shared C# Code

My Shoppe

Page 30: Powerful Backends with Microsoft Azure

Product catalog for field sales teams• 96% code reuse using

Xamarin.Forms• Data storage with Azure• Authentication with ADAL• Charting with SyncFusion

AppCRM

Page 31: Powerful Backends with Microsoft Azure

Consumer app built with Xamarin.Forms

• 93% code reuse• Azure backend• Templated push notifications• Authentication with Google OAuth

Sport

Page 32: Powerful Backends with Microsoft Azure

Get Started Todayxamarin.com

Page 33: Powerful Backends with Microsoft Azure

Free 30 Day Trial - xamarin.com/university

Unrivaled Mobile

Development Training

Live unlimited mobile development training from mobile experts, in your time-zone, on your schedule, and as often as you'd like.

Page 34: Powerful Backends with Microsoft Azure

evolve.xamarin.-com

Page 35: Powerful Backends with Microsoft Azure

• Azure• Blog: azure.microsoft.com/en-us/blog/• Twitter: twitter.com/azuremobile• Documentation:

azure.microsoft.com/en-us/documentation/services/app-service/• Xamarin• Blog: blog.xamarin.com• Twitter: twitter.com/xamarinhq• Documentation:

developer.xamarin.com/guides/cross-platform/azure/mobile-services/

Resources

Page 36: Powerful Backends with Microsoft Azure

Thank You! Questions?Pierce BogganSoftware Engineer, Evangelism Team, Xamarin

@pierceboggan @bostonmobiledev

github.com/pierceboggan