SlideShare a Scribd company logo
1 of 23
Laat ons weten wat u vindt van deze sessie! Vul de evaluatie
in via www.techdaysapp.nl en maak kans op een van de 20
prijzen*. Prijswinnaars worden bekend gemaakt via Twitter
(#TechDaysNL). Gebruik hiervoor de code op uw badge.
Let us know how you feel about this session! Give your
feedback via www.techdaysapp.nl and possibly win one of
the 20 prizes*. Winners will be announced via Twitter
(#TechDaysNL). Use your personal code on your badge.
* Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are
examples
Building Mobile Apps
with a Mobile Services
.NET Backend
Sasha Goldshtein
CTO, Sela Group
Microsoft C# MVP, Azure MRS, Azure Insider
blog.sashag.net
@goldshtn
Who are we?
App developers
What do we hate?
Backends
Azure Mobile Services is a backend
for your mobile apps
… that has a free tier
… and cloud scale
… and support for all mobile
platforms
This talk will focus on the .NET
backend and the C# clients
… the Node.js backend with
iOS/Android clients was discussed
earlier today
Platforms and Features
Platforms (client libraries)
• Windows Phone
• Windows 8
• Xamarin
• iOS
• Android
• HTML/JavaScript
• PhoneGap
Features
• Data and queries
• Push notifications
• Authentication
• Data access customization
• Custom API
• Offline sync
• Mass push
• Remote debugging
• Local deployment for testing
System Diagram
Microsoft Azure
SQL
Database
ASP.NET
Web API
backend
Microsoft
Push
Notification
Service
Facebook
Auth Provider
Windows
Notification
Service
Microsoft Auth
Provider
Data Query
var service = new MobileServiceClient(
“http://rentahome.azure-mobile.net/”,
“<APPLICATION KEY>”
);
var table = service.GetTable<Apartment>();
List<Apartment> apartments =
await table.Where(a => a.Rented == false)
.ToListAsync();
Authentication
var user = await service.LoginAsync(
MobileAuthenticationProvider.Facebook);
Client-Side Push Registration
var channel = await PushNotificationChannelManager.
CreatePushNotificationChannelForApplicationAsync();
await service.GetPush()
.RegisterNativeAsync(channel.Uri);
Visual Studio Support
Server-Side Push
public async Task<IHTTPActionResult> PostApartment(
Apartment apartment)
{
var inserted = await InsertAsync(apartment);
var push = new ApplePushMessage(
“Added apartment at ” + apartment.Address, null);
await Services.Push.SendAsync(push);
return CreatedAtRoute(“Tables”,
new { id = inserted.Id }, inserted);
}
Server-Side Authorization
[RequiresAuthorization(AuthorizationLevel.User)]
public async Task<IHTTPActionResult> PostApartment(
Apartment apartment)
{
var inserted = await InsertAsync(apartment);
return CreatedAtRoute(“Tables”,
new { id = inserted.Id }, inserted);
}
Demo
Building the “Rent a Home”
Windows Store App
with the Mobile Services .NET Backend
Offline Sync Support
Currently in Preview, only for Windows Store apps
Uses SQLite backing store
Manual push and pull, no auto-sync
Conflict detection and management
Preparing Data Model for Offline
Sync Support
public class Apartment
{
public string Id { get; set; }
public bool Rented { get; set; }
public string Address { get; set; }
public uint Bedrooms { get; set; }
[Version]
public string Version { get; set; }
}
Initializing Sync Table and Store
var table = service.GetSyncTable<Apartment>();
if (!service.SyncContext.IsInitialized)
{
var store = new MobileServiceSQLiteStore(“my.db”);
store.DefineTable<Apartment>()
await service.SyncContext.InitializeAsync(store,
new MobileServiceSyncHandler());
}
Pull and Push
// May throw if there is a connection problem
await table.PullAsync();
var list = await table.OrderBy(a => a.Bedrooms)
.ToListAsync();
table.Insert(new Apartment(...));
// May throw if there is a connection problem
// or a conflict, cf. MobileServicePushFailedException
service.SyncContext.PushAsync();
Demo
Adding Offline Sync Support
Questions?
Sasha Goldshtein
blog.sashag.net
@goldshtn
Laat ons weten wat u vindt van deze sessie! Vul de evaluatie
in via www.techdaysapp.nl en maak kans op een van de 20
prijzen*. Prijswinnaars worden bekend gemaakt via Twitter
(#TechDaysNL). Gebruik hiervoor de code op uw badge.
Let us know how you feel about this session! Give your
feedback via www.techdaysapp.nl and possibly win one of
the 20 prizes*. Winners will be announced via Twitter
(#TechDaysNL). Use your personal code on your badge.
* Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are
examples
Building Mobile Apps with a Mobile Services .NET Backend

More Related Content

Similar to Building Mobile Apps with a Mobile Services .NET Backend

Building a chat app with windows azure mobile
Building a chat app with windows azure mobileBuilding a chat app with windows azure mobile
Building a chat app with windows azure mobile
Flavius-Radu Demian
 
Reusing JavaScript knowledge in Windows Store apps
Reusing JavaScript knowledge in Windows Store appsReusing JavaScript knowledge in Windows Store apps
Reusing JavaScript knowledge in Windows Store apps
Timmy Kokke
 

Similar to Building Mobile Apps with a Mobile Services .NET Backend (20)

Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
VSTS and VS AppCenter overview and mobile releases 2018-05-30
VSTS and VS AppCenter overview and mobile releases 2018-05-30VSTS and VS AppCenter overview and mobile releases 2018-05-30
VSTS and VS AppCenter overview and mobile releases 2018-05-30
 
Building a chat app with windows azure mobile
Building a chat app with windows azure mobileBuilding a chat app with windows azure mobile
Building a chat app with windows azure mobile
 
Reusing JavaScript knowledge in Windows Store apps
Reusing JavaScript knowledge in Windows Store appsReusing JavaScript knowledge in Windows Store apps
Reusing JavaScript knowledge in Windows Store apps
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You Typed
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
Integrating WordPress With Web APIs
Integrating WordPress With Web APIsIntegrating WordPress With Web APIs
Integrating WordPress With Web APIs
 
2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile Services2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile Services
 
Building Push Triggers for Logic Apps
Building Push Triggers for Logic AppsBuilding Push Triggers for Logic Apps
Building Push Triggers for Logic Apps
 
Metaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdfMetaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdf
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Telerik Kendo UI Overview
Telerik Kendo UI OverviewTelerik Kendo UI Overview
Telerik Kendo UI Overview
 
Introduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backendIntroduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backend
 
2014 SharePoint Saturday Melbourne Apps or not to Apps
2014 SharePoint Saturday Melbourne Apps or not to Apps2014 SharePoint Saturday Melbourne Apps or not to Apps
2014 SharePoint Saturday Melbourne Apps or not to Apps
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile Services
 
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
 
IoTSummit - Introduction to IoT Hub
IoTSummit - Introduction to IoT HubIoTSummit - Introduction to IoT Hub
IoTSummit - Introduction to IoT Hub
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 

More from Sasha Goldshtein

The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
Sasha Goldshtein
 
Staring into the eBPF Abyss
Staring into the eBPF AbyssStaring into the eBPF Abyss
Staring into the eBPF Abyss
Sasha Goldshtein
 

More from Sasha Goldshtein (20)

Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
 
The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
 
Staring into the eBPF Abyss
Staring into the eBPF AbyssStaring into the eBPF Abyss
Staring into the eBPF Abyss
 
Visual Studio 2015 and the Next .NET Framework
Visual Studio 2015 and the Next .NET FrameworkVisual Studio 2015 and the Next .NET Framework
Visual Studio 2015 and the Next .NET Framework
 
Swift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS XSwift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS X
 
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
C# Everywhere: Cross-Platform Mobile Apps with XamarinC# Everywhere: Cross-Platform Mobile Apps with Xamarin
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
 
Modern Backends for Mobile Apps
Modern Backends for Mobile AppsModern Backends for Mobile Apps
Modern Backends for Mobile Apps
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
 
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
 
Mastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and ProductionMastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and Production
 
Introduction to RavenDB
Introduction to RavenDBIntroduction to RavenDB
Introduction to RavenDB
 
State of the Platforms
State of the PlatformsState of the Platforms
State of the Platforms
 
Task and Data Parallelism
Task and Data ParallelismTask and Data Parallelism
Task and Data Parallelism
 
What's New in C++ 11?
What's New in C++ 11?What's New in C++ 11?
What's New in C++ 11?
 
Attacking Web Applications
Attacking Web ApplicationsAttacking Web Applications
Attacking Web Applications
 
First Steps in Android Development
First Steps in Android DevelopmentFirst Steps in Android Development
First Steps in Android Development
 
First Steps in iOS Development
First Steps in iOS DevelopmentFirst Steps in iOS Development
First Steps in iOS Development
 
JavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows AzureJavaScript, Meet Cloud: Node.js on Windows Azure
JavaScript, Meet Cloud: Node.js on Windows Azure
 
First Steps in Android Development with Eclipse and Xamarin
First Steps in Android Development with Eclipse and XamarinFirst Steps in Android Development with Eclipse and Xamarin
First Steps in Android Development with Eclipse and Xamarin
 
Visual Studio 2013: Exploration, Productivity, Diagnostics, Collaboration
Visual Studio 2013: Exploration, Productivity, Diagnostics, CollaborationVisual Studio 2013: Exploration, Productivity, Diagnostics, Collaboration
Visual Studio 2013: Exploration, Productivity, Diagnostics, Collaboration
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Building Mobile Apps with a Mobile Services .NET Backend

  • 1.
  • 2. Laat ons weten wat u vindt van deze sessie! Vul de evaluatie in via www.techdaysapp.nl en maak kans op een van de 20 prijzen*. Prijswinnaars worden bekend gemaakt via Twitter (#TechDaysNL). Gebruik hiervoor de code op uw badge. Let us know how you feel about this session! Give your feedback via www.techdaysapp.nl and possibly win one of the 20 prizes*. Winners will be announced via Twitter (#TechDaysNL). Use your personal code on your badge. * Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are examples
  • 3. Building Mobile Apps with a Mobile Services .NET Backend Sasha Goldshtein CTO, Sela Group Microsoft C# MVP, Azure MRS, Azure Insider blog.sashag.net @goldshtn
  • 4. Who are we? App developers What do we hate? Backends
  • 5. Azure Mobile Services is a backend for your mobile apps … that has a free tier … and cloud scale … and support for all mobile platforms
  • 6. This talk will focus on the .NET backend and the C# clients … the Node.js backend with iOS/Android clients was discussed earlier today
  • 7. Platforms and Features Platforms (client libraries) • Windows Phone • Windows 8 • Xamarin • iOS • Android • HTML/JavaScript • PhoneGap Features • Data and queries • Push notifications • Authentication • Data access customization • Custom API • Offline sync • Mass push • Remote debugging • Local deployment for testing
  • 8. System Diagram Microsoft Azure SQL Database ASP.NET Web API backend Microsoft Push Notification Service Facebook Auth Provider Windows Notification Service Microsoft Auth Provider
  • 9. Data Query var service = new MobileServiceClient( “http://rentahome.azure-mobile.net/”, “<APPLICATION KEY>” ); var table = service.GetTable<Apartment>(); List<Apartment> apartments = await table.Where(a => a.Rented == false) .ToListAsync();
  • 10. Authentication var user = await service.LoginAsync( MobileAuthenticationProvider.Facebook);
  • 11. Client-Side Push Registration var channel = await PushNotificationChannelManager. CreatePushNotificationChannelForApplicationAsync(); await service.GetPush() .RegisterNativeAsync(channel.Uri);
  • 13. Server-Side Push public async Task<IHTTPActionResult> PostApartment( Apartment apartment) { var inserted = await InsertAsync(apartment); var push = new ApplePushMessage( “Added apartment at ” + apartment.Address, null); await Services.Push.SendAsync(push); return CreatedAtRoute(“Tables”, new { id = inserted.Id }, inserted); }
  • 14. Server-Side Authorization [RequiresAuthorization(AuthorizationLevel.User)] public async Task<IHTTPActionResult> PostApartment( Apartment apartment) { var inserted = await InsertAsync(apartment); return CreatedAtRoute(“Tables”, new { id = inserted.Id }, inserted); }
  • 15. Demo Building the “Rent a Home” Windows Store App with the Mobile Services .NET Backend
  • 16. Offline Sync Support Currently in Preview, only for Windows Store apps Uses SQLite backing store Manual push and pull, no auto-sync Conflict detection and management
  • 17. Preparing Data Model for Offline Sync Support public class Apartment { public string Id { get; set; } public bool Rented { get; set; } public string Address { get; set; } public uint Bedrooms { get; set; } [Version] public string Version { get; set; } }
  • 18. Initializing Sync Table and Store var table = service.GetSyncTable<Apartment>(); if (!service.SyncContext.IsInitialized) { var store = new MobileServiceSQLiteStore(“my.db”); store.DefineTable<Apartment>() await service.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler()); }
  • 19. Pull and Push // May throw if there is a connection problem await table.PullAsync(); var list = await table.OrderBy(a => a.Bedrooms) .ToListAsync(); table.Insert(new Apartment(...)); // May throw if there is a connection problem // or a conflict, cf. MobileServicePushFailedException service.SyncContext.PushAsync();
  • 22. Laat ons weten wat u vindt van deze sessie! Vul de evaluatie in via www.techdaysapp.nl en maak kans op een van de 20 prijzen*. Prijswinnaars worden bekend gemaakt via Twitter (#TechDaysNL). Gebruik hiervoor de code op uw badge. Let us know how you feel about this session! Give your feedback via www.techdaysapp.nl and possibly win one of the 20 prizes*. Winners will be announced via Twitter (#TechDaysNL). Use your personal code on your badge. * Over de uitslag kan niet worden gecorrespondeerd, prijzen zijn voorbeelden – All results are final, prizes are examples