SlideShare a Scribd company logo
Occasionally Connected Systems
Rahul Marathe
Consultant
Microsoft Global Services
Session Code:
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
Sync Services Framework
 Platform to build sync ecosystems
 Topology, data independent framework
 Based on provider model
Sync services framework
                       Application




                       Runtime



     Synchronization                 Synchronization
        provider                        provider


         Data                            Data
        Source                          Source
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
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
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
VS 2008 Tooling support
Rahul Marathe
Consultant
Microsoft Global Services India
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
Customizing synchronization
 Server side customization
    Custom sync adapters & ‘commands’
    Consuming filters
 Client side customization
    Setting up filters
    ApplyingChanges event
    Synchronization progress
Customizing synchronization
Rahul Marathe
Consultant
Microsoft Global Services India
Conflicts & tracing
 What are conflicts
    Errors
    Conflicts
 ApplyChangesFailed event to handle conflicts
    ConflictType
    ApplyAction
    Exception
 Enabling transport level tracing
    WCF tracing, Service trace viewer tool
    Database Profiler
Conflict resolution & tracing
Rahul Marathe
Consultant
Microsoft Global Services India
Occasionally Connected Systems
© 2009 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.

More Related Content

Occasionally Connected Systems

  • 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
  • 13. Conflicts & tracing What are conflicts Errors Conflicts ApplyChangesFailed event to handle conflicts ConflictType ApplyAction Exception Enabling transport level tracing WCF tracing, Service trace viewer tool Database Profiler
  • 14. Conflict resolution & tracing Rahul Marathe Consultant Microsoft Global Services India
  • 16. © 2009 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.

Editor's Notes

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  7. Same data getting changed by multiple users might result into conflictsConflicts are detected at a row levelBoth errors and conflicts are treated as conflicts
  8. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.