250 likes | 441 Views
TL08. Offline-Enabled Data Services And Desktop Applications. Pablo Castro Software Architect Microsoft Corporation. Agenda. Why The problem space What The developer experience How A look at the details When Standard roadmap drill. Why: Motivation. Why “offline”
E N D
TL08 Offline-Enabled Data Services And Desktop Applications Pablo Castro Software Architect Microsoft Corporation
Agenda • Why • The problem space • What • The developer experience • How • A look at the details • When • Standard roadmap drill
Why: Motivation • Why “offline” • Access to a service may not be always available • Bandwidth may not be enough/too expensive • etc. • Why “data services” • We have sync technology for databases, but… • Lots of data now sits behind a service boundary • We can layer more data capabilities on services with a uniform interface
Application Scenarios • Offline-capable applications • Microsoft Outlook-style applications • Service is typically domain specific, includes business logic • Application speed-up/bandwidth usage • Cache service data locally for fast processing • Could be a general purpose data service • Closed-system versus external services • Service side may be a 3rd party service
What: Taking Services Offline • Project Codename “Astoria Offline” • End-to-end solution • Visual Studio integrated experience • Sync APIs, algorithms, formats, protocols • Modeled at the level of conceptual “entities” • Client and service environment setup • Sync-enable database schemas • Generate sync-enabled clients • Maintains an open interface
Application Model Online clients can consume service Sync-enabled service Sync in the background 1-tier client application Local schema follows service
Sync-Enabling a Service • “Piece of cake” scenario • Relational database through Entity Framework • Augment the database with sync information • Add sync-related elements to metadata files • Enable synchronization in the service itself • You can also do everything manually
Creating Sync-Enabled Clients • Client-side “piece of cake” flow • “Add service reference” will prompt if the server is sync-enabled • Download service metadata • Create local Compact database • Setup Entity Framework data-access layer • Add sync support to both database and Entity Framework • Can also use the building blocks independently
Building On Existing Technology Data Services Framework: RESTful data services Regular Desktop/Server application Sync Framework Sync Framework Entity Framework: local data access Entity Framework: Model & Data Access Data source extensibility Local store: SQL Server Compact Database:SQL Server
Typical Requirements • Business logic • Server: Query and change interceptors • Client: Usual UI interaction, plus sync events • Conflict detection and resolution • We’ll precisely detect conflicts • You provide resolution handlers • Incremental synchronization • Batching & dependency management • Choosing which data to sync • Scopes
Security Aspects • Authentication • ASP.NET authentication model applies • Built-in Windows, Forms auth • Modules for Basic and custom schemes • Authorization • Query/change interceptors on the server • Use ASP.NET roles or custom code
How: The Details • Synchronization Strategy • Interaction model • Database schema requirements
Synchronization Strategy • Follow the Microsoft Sync Framework way • Multi-master replication • Peers make changes independently • Sync makes peers aware of all changes • Reliable, precise conflict detection • Minimize over-enumeration
Basic Concepts • “Scope” • All things you want to synchronize • “Version” • A change is tagged with “who” and “when” • “Knowledge” • Concise description of the set of changes that a peer is aware of • Can be understood by any peer • Main operations on knowledge • Test if a given knowledge covers a given change • Add one piece of knowledge to another to produce combined knowledge
1. Request changes 3. Send changes 2. Enumerate Changes 4. Apply Changes Interaction Model • Request changes based on A’s knowledge • Enumerate changes in B: Is B’s version covered by A’s knowledge? If not, send • Send changes: Version of change, B’s knowledge • Apply Changes: Is A’s version covered by B’s knowledge? If not, there is a conflict A B
Data Store Requirements • Per-scope • A place to put knowledge in (1 row) • Per-entity • Creation version (node, tick count) • Modification version (node, tick count) • Globally unique Sync ID • Deletion markers
Sync Metadata In Entity Framework • Default strategy used by Visual Studio • Side tables for sync version information • Columns in user tables (timestamp x 2, syncid) • Delete trigger for deletion markers • Gets better with Compact and SQL Server 2008 • Can be completely replaced • We define an “API” in terms of entry points • Encapsulated in Entity Framework metadata files
When: Roadmap To "Astoria Offline" • Alpha preview release before end of year • We’ll ship CTPs as we make progress • What we want to take on • v1: core protocol/service support in place, great tooling • Later: first-class devices support, more application services, scenarios for synchronization other than offline
We'd Love To Hear From You • We are following our “transparent design” process • Design notes posted in the Astoria Team blog • http://blogs.msdn.com/astoriateam • Feedback is welcome, the earlier the more likely we can incorporate it • You get to see team members in an awkward setting trying to explain features in videos
Summary • “Astoria Offline” enables applications to take data from services offline • Work while disconnected • Speed and bandwidth optimizations • End-to-end solution • Tools, runtime, database support • Starts easy, incrementally customizable • Builds on existing technology for data, services and synchronization
Resources • Blogs • Astoria team http://blogs.msdn.com/astoriateam • Minehttp://blogs.msdn.com/pablo • @ MSDN • Data: http://msdn.microsoft.com/data • Sync: http://msdn.microsoft.com/en-us/sync/default.aspx • @ PDC • TL30 Microsoft Sync Framework Advances • TL07 Developing Applications Using Data Services • TL20 Entity Framework Futures
Q&A Please use the microphones provided
Evals & Recordings Please fill out your evaluation for this session at: This session will be available as a recording at: www.microsoftpdc.com
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.