Building Offline Applications using Sync Framework, SQL Server and SQL Azure Eduardo Castro Martinez http://ecastrom.blogspot.com http://comunidadwindows.org twitter: edocastro
Session Objectives and Takeaways Objectives: Learn about the advantages of offline application architecture Learn how to build offline applications to synchronize data across different client platforms using Sync Framework Learn about developer choice and interoperability for 3rd party endpoints Key Takeaway: Offline applications have lots of benefits comparing to online applications, especially for mobile devices and cloud services Sync Framework, SQL Azure and Windows Azure provide a data platform that makes it very easy to build offline applications and sync services. Sync Framework caters for offline clients on any client platform, and provides better end-to-end support for Windows, Silverlight and Windows Phone 7 clients.
Why Build Offline Capable Apps Server / Service Offline/Cached mode apps enjoy lots of value Client apps get better UX through Lower latency – data access doesn’t require round trips Higher availability – app still runs if server is unreachable Reduced network utilization – most data access is local Servers gain better ability to schedule work asynchronously Benefits of cached mode are magnified on the Internet Server/service is further away Network is less tuned/reliable Remote Store Sync Offline Client Client App Query / Update Local Data Cache
Links Sync Framework 4.0 Download http://bit.ly/syncfr40 Developer Center http://bit.ly/syncdev Sync SQL Server http://bit.ly/syncsql
Windows - SQL Server Express - SQL Compact Easy to develop the sync endpoints Sync smarts on server, not on client Client Offline Apps Sync Endpoints SyncFx Client API support Client API support Silverlight Isolated Storage - Other stores - Auth / Mgmt / Bus Logic Sync Service SQL Server Windows Phone 7
Simple protocol (OData& Sync) Windows Server / IIS Cloud Sync Windows Mobile SQL Compact - On-Premises Sync Endpoints SyncFx Browser / HTML5 - HTML5 stores Auth / Mgmt / Bus Logic SQL Azure Minimal client & store requirements iPhone / Any Client SQLite / Any store - WindowsAzure Sync Framework v4 Overview
Introduction to Microsoft Sync Framework Microsoft Sync Framework is a comprehensive synchronization platform enabling collaboration and offline for applications, services and devices. Developers can build synchronization ecosystems that integrate any application, any data from any store using any protocol over any network.
Introduction to Microsoft Sync Framework A key aspect of Sync Framework is the ability to create custom providers
Included Providers Database synchronization providers: Synchronization for ADO.NET-enabled data sources File synchronization provider: Synchronization for files and folders Web synchronization components: Synchronization for FeedSync feeds such as RSS and ATOM feeds
Participant Types Full participants are devices that allow developers to create applications and new data stores directly on the device Partial participants are devices that have the ability to store data either in the existing data store or another data store on the device.
Participant Types Simple participants are devices that are only capable of providing information when requested. These devices cannot store or manipulate new data and are unable to support the creation of new applications
Core Components A provider built using Sync Framework communicates with a data source and retrieves state information from a metadata store
Core Components Data Source The data source is the location where all information which needs to be synchronized is stored. Could be a relational database, a file, a Web Service or even a custom data source included within a line of business application. As long as you can programmatically access the data, it can participate in synchronization.
Core Components Metadata Ability to store information about the data store and the objects within that data store with respect to state and change information The metadata for a data store can be broken down into five key components Versions Knowledge Tick count Replica ID Tombstones
Conflicts are Detected and Resolved or Deferred Source Wins: Changes made by the local replica always win in the event of a conflict. Destination Wins: Remote replica always wins Specified Replica ID Always Wins: No matter who changes an item, the replica with the designated ID always wins. Last-Writer Wins: Based on the assumption that all replicas are trusted to make changes and wall clocks are synchronized, allow the last writer to win. Merge: In the event of two duplicate items in conflict, merge the information from one into the other. Log Conflict: Choose to simply log or defer the conflict.
Database Synchronization and the Microsoft Sync Framework Comprehensive synchronization platform that enables developers to add synchronization capabilities to applications, services, and devices. Sync Framework solves the problem of how to synchronize any type of data in any store using any protocol over any topology
Sync Service Overview Data Store Expose data from SQL Azure or SQL Server Host Hosted on Windows Azure or IIS/Windows Server Exposed using a WCF sync endpoint Protocol Expose data for synchronization via a protocol and allow 3rd parties to build offline clients Features Support business logic extensity Custom authentication / authorization Filtering Tooling Provide a Tooling Wizard experience to configuring server and client
Enables Offline In Isolated Storage with Silverlight 3 & 4
Extensibility to allow 3rd party storage to be hooked in
Offline Applications for all platforms Offline application on any platform Sync Application Windows Azure Application OData Sync Service OData Sync Proxy Sync Business Logic SQL Azure Provider Sync Logic Collections Store SQL Azure Client Needs To:
Track changes on local store (samples for common stores).
Implement client side sync proxy (samples for common platforms)
Offline Application on HTML5 across browsers
Offline Applications Architecture - Protocol Simple protocol (OData & Sync) Offline application on any platform Sync Application Windows Azure Application OData Sync Service OData Sync Proxy Sync Business Logic SQL Azure Provider Sync Logic Collections Store SQL Azure
OData Protocol & Sync Apply the principals of OData to the problem of data-sync Standardize on protocol not on components Minimal client sync logic or algorithms Service manages sync keeping client simple Provide samples to show how to consume protocol for any platform Provide components for richer experience in Silverlight& WP7 Full interop details defined in SDK
SQL Azure Data Sync CTP1 (Available now from http://azure.com) Sync End to End Scenarios Offline Applications Sync Sync Sync Sync On-Premises Applications Sync Sync Sync SQL Azure Database Sync Sync Sync Microsoft Sync Framework 4.0 CTP available now! Retail & Remote Offices SQL Azure Data Sync http://azure.com SQL Azure Data Sync CTP2 (Coming in near future)
Sync Framework – Offline SupportReleases and Roadmap
Sync Framework – Offline Support Call to Action For more information on Sync Framework 4.0 CTP MSDN Developer Center: http://msdn.com/sync/ Try it out Download “Sync Framework 4.0 October 2010 CTP” from Microsoft Download Center The sync service sample for Windows Azure or on-premises Client samples for Silverlight, WP7, WM6.5 & iPhone, HTML5 Give feedback Scenarios to support, capabilities or feature requests, preview release problems, etc…
Building Offline Applications using Sync Framework, SQL Server and SQL Azure Eduardo Castro Martinez Arquitecto http://ecastrom.blogspot.com http://comunidadwindows.org twitter: edocastro