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.
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
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
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