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
prijz...
Building Mobile Apps
with a Mobile Services
.NET Backend
Sasha Goldshtein
CTO, Sela Group
Microsoft C# MVP, Azure MRS, Azu...
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 mob...
This talk will focus on the .NET
backend and the C# clients
… the Node.js backend with
iOS/Android clients was discussed
e...
Platforms and Features
Platforms (client libraries)
• Windows Phone
• Windows 8
• Xamarin
• iOS
• Android
• HTML/JavaScrip...
System Diagram
Microsoft Azure
SQL
Database
ASP.NET
Web API
backend
Microsoft
Push
Notification
Service
Facebook
Auth Prov...
Data Query
var service = new MobileServiceClient(
“http://rentahome.azure-mobile.net/”,
“<APPLICATION KEY>”
);
var table =...
Authentication
var user = await service.LoginAsync(
MobileAuthenticationProvider.Facebook);
Client-Side Push Registration
var channel = await PushNotificationChannelManager.
CreatePushNotificationChannelForApplicat...
Visual Studio Support
Server-Side Push
public async Task<IHTTPActionResult> PostApartment(
Apartment apartment)
{
var inserted = await InsertAsy...
Server-Side Authorization
[RequiresAuthorization(AuthorizationLevel.User)]
public async Task<IHTTPActionResult> PostApartm...
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 ...
Preparing Data Model for Offline
Sync Support
public class Apartment
{
public string Id { get; set; }
public bool Rented {...
Initializing Sync Table and Store
var table = service.GetSyncTable<Apartment>();
if (!service.SyncContext.IsInitialized)
{...
Pull and Push
// May throw if there is a connection problem
await table.PullAsync();
var list = await table.OrderBy(a => a...
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
prijz...
Building Mobile Apps with a Mobile Services .NET Backend
Building Mobile Apps with a Mobile Services .NET Backend
Upcoming SlideShare
Loading in...5
×

Building Mobile Apps with a Mobile Services .NET Backend

1,433

Published on

Presentation from TechDays Netherlands 2014 on using the newly announced .NET backend for Azure Mobile Services to build mobile applications, and on using the Offline Sync preview in Windows Store apps.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,433
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building Mobile Apps with a Mobile Services .NET Backend

  1. 1. 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
  2. 2. 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
  3. 3. Who are we? App developers What do we hate? Backends
  4. 4. Azure Mobile Services is a backend for your mobile apps … that has a free tier … and cloud scale … and support for all mobile platforms
  5. 5. This talk will focus on the .NET backend and the C# clients … the Node.js backend with iOS/Android clients was discussed earlier today
  6. 6. 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
  7. 7. System Diagram Microsoft Azure SQL Database ASP.NET Web API backend Microsoft Push Notification Service Facebook Auth Provider Windows Notification Service Microsoft Auth Provider
  8. 8. 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();
  9. 9. Authentication var user = await service.LoginAsync( MobileAuthenticationProvider.Facebook);
  10. 10. Client-Side Push Registration var channel = await PushNotificationChannelManager. CreatePushNotificationChannelForApplicationAsync(); await service.GetPush() .RegisterNativeAsync(channel.Uri);
  11. 11. Visual Studio Support
  12. 12. 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); }
  13. 13. 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); }
  14. 14. Demo Building the “Rent a Home” Windows Store App with the Mobile Services .NET Backend
  15. 15. 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
  16. 16. 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; } }
  17. 17. 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()); }
  18. 18. 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();
  19. 19. Demo Adding Offline Sync Support
  20. 20. Questions? Sasha Goldshtein blog.sashag.net @goldshtn
  21. 21. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×