Rahul Marathe from Microsoft Global Services discusses ADO.Net sync services which allow for synchronizing ADO.net databases in peer-to-peer and client-server scenarios. The sync services framework uses a provider model and supports syncing SQL Server databases to SQL Compact databases on mobile devices. Visual Studio 2008 SP1 provides tooling support for configuring sync providers and generating client and server code for occasional connected applications. The presentation also covers customizing synchronization with filters, handling conflicts, and enabling tracing.
3. Key Takeaways
ADO.Net sync services architecture
Build an occasionally connected app using VS 2008 SP1
Implement user based data filtering
Conflict resolution , tracing support
4. Sync Services Framework
Platform to build sync ecosystems
Topology, data independent framework
Based on provider model
5. Sync services framework
Application
Runtime
Synchronization Synchronization
provider provider
Data Data
Source Source
6. ADO.Net sync services
Provider for synchronizing ADO.net based databases
Support for peer-peer ,client-server scenarios
Tooling support in VS 2008 SP1
Synchronization adapter builder
7. ADO.net sync services configuration
N-tier architecture
Tooling support for generating client & server side code
Data Forms
Data Access Transport
Client ServerSyncProvider
SyncAgent
SyncProvider
Service
Proxy Service
SQL Server
Compact
SyncGroup
Server DB
3.5 SyncAdapter
SyncTable
8. Development Environment
Server
.Net framework v3.5 SP1, ADO.net v2.0
ADO.net sync services v1.0 SP1 desktop
SQL Server 2008 – change tracking enabled on the database
Client
.Net compact framework v3.5
ADO.net sync services v1.0 SP1 - devices
SQL Compact 3.5 SP1 – devices
Windows Mobile 6.0 Professional SDK
Development environment
Visual Studio 2008 SP1
9. VS 2008 Tooling support
Rahul Marathe
Consultant
Microsoft Global Services India
10. Tooling support - summary
Server
WCF Application & WCF Library project
Add ‘Local Data Cache’ item, configure the sync providers
Decorate web service contract with XMLSerializerFormat
attribute
Client
Device application - .Net CF 3.5, SQL Compact 3.5 SP1
WCF proxy
Peek into the auto generated code
Server - SyncCacheContract, SyncAdapters
Client - SyncAgent
11. Customizing synchronization
Server side customization
Custom sync adapters & ‘commands’
Consuming filters
Client side customization
Setting up filters
ApplyingChanges event
Synchronization progress
Sync frameworkFeatures technologies and tools that enable roaming, taking data offline & in certain scenariossharing of data between peersCore components / sync runtime responsible for orchestrating the sync processRuntime achieves sync via making calls to what we call as ‘Providers’Communicate status, conflicts & errors to the client application
Provider for synchronizing ADO.net based data sourcesThe participating databases may be different productsIn case of windows mobile, provider is available for SQL Compact 3.5 SP1 Peer – peer topology Client – Server2 – tier – Client & the server provider reside on the same boxN – tier – web service based, client and server providers are distributedTooling supportTakes care of the plumbing codeGenerates client adapter & server provider codeTight integration with SQL 2008 change tracking featureAdapter builder – simillar to ADO.net command builder
Configuration to sync data between Windows mobile running SQL Compact 3.5 & Server DatabaseADO.Net sync provider on the web serverSync services exposed via web serviceSyncAdapater – 1:1 mapping with tablesSQLCommand object sync download from server dbSQLCommand object for sync uploade from client dbData filtering implemented by customizing the SQLCommands of a syncAdapterClient Communicates with remote server via a ‘Proxy’Windows Forms application for a deviceLocal database SQL Compact 3.5SyncAgent – acts as a ‘Orchestrator’ for synchronizationSyncTable 1:1 mapping with the database tablesTransaction boundary - SyncGroups
Separate binaries for desktop & devicesSQL Server 2008 change trackingChange tracking built into the database engineAPI to access the change information, CHANGETABLE(……)No need for plumbing code
Client application - .Net CF 3.5 Windows Forms ApplicationServer application – WCF web application & web library local data cache is added to the WCF library Select server connection Add a list of tables Change the order – controls the order in which table data is synchedSyncDirection : Bidirectional,Download,Upload Apply XMLSerializerFormatattrribute to the contract - important Map the service to the implementation Add a service for exposing the sync service methodsGenerate WCF proxy using utility netcfsvcutil, apply the XMLSerializer attribute
If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
Same data getting changed by multiple users might result into conflictsConflicts are detected at a row levelBoth errors and conflicts are treated as conflicts
If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.