Pro Sync Framework

Book description

The Sync Framework is Microsoft's innovation to address the dilemma of occasionally connected systems. It is a comprehensive synchronization platform that enables collaboration and offline access for applications, services, and devices. In particular, it features technologies and tools that enable device roaming, sharing, and the ability to take networked data offline before synchronizing it back to the networked application at a later time.

Pro Sync Framework concludes with a working example that shows how the techniques you've learned can be used to create a versatile application, adaptable to a wide variety of connectivity and synchronization challenges.

Table of contents

  1. Copyright
  2. Foreword
  3. About the Authors
  4. About the Technical Reviewer
  5. Acknowledgments
  6. Introduction
    1. Overview
    2. Source Code for This Book
  7. 1. Introduction to the Microsoft Sync Framework
    1. 1.1. Benefits of Synchronization
    2. 1.2. Life Before Sync Framework
    3. 1.3. Why the Microsoft Sync Framework?
    4. 1.4. Installing Microsoft Sync Framework
      1. 1.4.1. Core Components
      2. 1.4.2. Synchronization Providers
      3. 1.4.3. Sync Framework Participants
    5. 1.5. Synchronization Flow
    6. 1.6. Synchronizing Two Replicas Using Built-in Providers
    7. 1.7. Summary
  8. 2. Microsoft Sync Framework Metadata
    1. 2.1. What Is Sync Metadata?
      1. 2.1.1. Metadata Store
      2. 2.1.2. Components of Sync Metadata
        1. 2.1.2.1. Version
        2. 2.1.2.2. Knowledge
      3. 2.1.3. Example of Sync Metadata Use
        1. 2.1.3.1. Content of Replica A
        2. 2.1.3.2. Content of Replica B
        3. 2.1.3.3. Content of Replica B
        4. 2.1.3.4. Content of Replica A
        5. 2.1.3.5. Content of Replica A
        6. 2.1.3.6. Content of Replica B
      4. 2.1.4. Sync Metadata Requirement
        1. 2.1.4.1. Required Metadata for the Replica
        2. 2.1.4.2. Required Metadata for the Item
    2. 2.2. Summary
  9. 3. Working with Synchronization Providers: Part 1
    1. 3.1. What Is a Sync Provider?
    2. 3.2. Synchronizing Two Replicas Using Built-in Providers
    3. 3.3. Creating a Synchronization Provider
    4. 3.4. Provider Writer Tasks
      1. 3.4.1. Change Tracking
      2. 3.4.2. Change Enumeration
      3. 3.4.3. Conflict Handling
      4. 3.4.4. Conflict Detection
      5. 3.4.5. Resolving Conflicts
      6. 3.4.6. Saving the Changes
      7. 3.4.7. Sample Synchronization Provider for Synchronizing SQL Server Databases
        1. 3.4.7.1. CreateReplica.Sql
        2. 3.4.7.2. Customer.cs
        3. 3.4.7.3. Constructor
        4. 3.4.7.4. Public Properties
        5. 3.4.7.5. Public Methods
        6. 3.4.7.6. Private Methods
        7. 3.4.7.7. ReplicaContent.cs
      8. 3.4.8. MySyncProvider.cs
        1. 3.4.8.1. Constructor
        2. 3.4.8.2. Change Tracking
          1. 3.4.8.2.1. Creating a New Item
          2. 3.4.8.2.2. Updating an Item
          3. 3.4.8.2.3. Deleting an Item
        3. 3.4.8.3. Implementing Transactions
      9. 3.4.9. Overriding Provider Methods
        1. 3.4.9.1.
          1. 3.4.9.1.1. Not-Implemented Methods
          2. 3.4.9.1.2. Releasing the Resources
          3. 3.4.9.1.3. SyncForm.cs
      10. 3.4.10. Creating New Customer Records
      11. 3.4.11. Synchronizing Replicas
      12. 3.4.12. Running the Sample Application
      13. 3.4.13. Synchronizing New Records
      14. 3.4.14. Detecting and Handling Conflicts
      15. 3.4.15. Synchronize Deleted Records
      16. 3.4.16. Finishing Synchronization
    5. 3.5. Summary
  10. 4. Working with Synchronization Providers: Part 2
    1. 4.1. Change Units
      1. 4.1.1. Creating Sync Providers with Change Units
    2. 4.2. Creating Providers That Use Asynchronous Change Tracking
      1. 4.2.1. MySyncProvider.cs
        1. 4.2.1.1. Removing Inline Tracking
        2. 4.2.1.2. Implementing Asynchronous Change Tracking
        3. 4.2.1.3. Changing Overridden Provider Methods to Use Asynchronous Change Tracking Methods
      2. 4.2.2. Changing the Customer.cs Class
      3. 4.2.3. Changes in the Synchronizing Application
        1. 4.2.3.1. ReplicaContent.cs
        2. 4.2.3.2. Running the Sample Application
        3. 4.2.3.3. Synchronizing New Records
        4. 4.2.3.4. Detecting and Handling Conflicts
        5. 4.2.3.5. Synchronizing Deleted Records
        6. 4.2.3.6. Finishing Synchronization
      4. 4.2.4. Creating a Generic Sync Provider
      5. 4.2.5. BaseSyncProvider
      6. 4.2.6. Extending the Generic Sync Provider Class
        1. 4.2.6.1. CustomDBProvider
        2. 4.2.6.2. MyDbSyncProvider.cs
        3. 4.2.6.3. Customer.cs
        4. 4.2.6.4. ReplicaContent.cs
        5. 4.2.6.5. Running the Sample Application
        6. 4.2.6.6. CustomFileProvider
          1. 4.2.6.6.1. MyFileSyncProvider.cs
          2. 4.2.6.6.2. MyTextFile.cs
          3. 4.2.6.6.3. FileSyncForm.cs
    3. 4.3. Summary
  11. 5. Working with File Synchronization Providers
    1. 5.1. Sync Framework Core Components
    2. 5.2. File Sync Provider
      1. 5.2.1. File Sync Provider Features
    3. 5.3. Sync Services Components for File Systems
      1. 5.3.1. Enumerations
      2. 5.3.2. Interfaces
      3. 5.3.3. Applications
    4. 5.4. Synchronizing Files and Folders Using Unmanaged Code
      1. 5.4.1. Creating the File Sync Provider
      2. 5.4.2. Initializing the File Sync Provider
      3. 5.4.3. Creating the Filter
      4. 5.4.4. Starting the Synchronization Process
    5. 5.5. Synchronizing Files and Folders Using Managed Code
      1. 5.5.1. Skipping the Files and Folders to Synchronize
      2. 5.5.2. Controlling Files and Folders to Synchronize
        1. 5.5.2.1. Applying Static Filters
    6. 5.6. Microsoft.Synchronization.Files Namespace
      1. 5.6.1. FileSyncProvider Class
      2. 5.6.2. FileSyncScopeFilter Class
      3. 5.6.3. Detecting the Changes
        1. 5.6.3.1. Using the Built-in Change Detection Algorithm
      4. 5.6.4. Using Changes to the Hash Value
      5. 5.6.5. Reporting Progress
    7. 5.7. Implementing a Sample Application
      1. 5.7.1. Complete Source Code
    8. 5.8. Summary
  12. 6. Microsoft Sync Framework Metadata Storage Service
    1. 6.1. Metadata Storage Service
    2. 6.2. Built-in SQL Server CE Metadata Store
      1. 6.2.1. Using a SQL Server CE Metadata Store vs. a Custom Metadata Store
      2. 6.2.2. Locating the Metadata Store
      3. 6.2.3. Interacting with Provider
    3. 6.3. Implementing the Custom Metadata Store
      1. 6.3.1. Creating a Custom Metadata Store
        1. 6.3.1.1. CustomItemMetadata.cs
          1. 6.3.1.1.1. ItemId
          2. 6.3.1.1.2. CreationVersion
          3. 6.3.1.1.3. ChangeVersion
          4. 6.3.1.1.4. Uri
          5. 6.3.1.1.5. IsTombstone
        2. 6.3.1.2. CustomMetadataStore.cs
      2. 6.3.2. Properties
        1. 6.3.2.1. Metadata Directory
        2. 6.3.2.2. ItemMetadataFilePath
        3. 6.3.2.3. ReplicaIdFilePath
        4. 6.3.2.4. ReplicaId
        5. 6.3.2.5. TickCountFilePath
        6. 6.3.2.6. TickCount
        7. 6.3.2.7. KnowledgeFilePath
        8. 6.3.2.8. MyKnowledge
        9. 6.3.2.9. MyForgottenKnowledge
        10. 6.3.2.10. RequestedBatchSize
        11. 6.3.2.11. IdFormats
      3. 6.3.3. Methods
        1. 6.3.3.1. Creating a Metadata Store
        2. 6.3.3.2. Initializing the Metadata Store
        3. 6.3.3.3. Searching, Manipulating, and Saving Item Metadata.
        4. 6.3.3.4. Manipulating and Saving the Replica ID
        5. 6.3.3.5. Manipulating and Saving Current and Forgotten Knowledge
        6. 6.3.3.6. Manipulating and Saving Tick Count
        7. 6.3.3.7. Releasing the Metadata Store at the End of the Sync Session
      4. 6.3.4. Changing the Custom Sync Provider to Use the Custom Metadata Store
        1. 6.3.4.1. Implementing Change Tracking with the Custom Metadata Store
        2. 6.3.4.2. Implementing Sync Session Methods with Custom Metadata Store
      5. 6.3.5. Changing the Application to Use the Changed Custom Sync Provider
        1. 6.3.5.1. Running the Application
          1. 6.3.5.1.1. Synchronizing New Records
          2. 6.3.5.1.2. Detecting and Handling Conflicts
          3. 6.3.5.1.3. Synchronize Deleted Records
          4. 6.3.5.1.4. Completing Synchronization
    4. 6.4. Summary
  13. 7. Working with RSS Sync Feeds
    1. 7.1. Sync Services for FeedSync
    2. 7.2. Microsoft.Synchronization.FeedSync Namespace
      1. 7.2.1. Managed Code
      2. 7.2.2. Unmanaged Code
    3. 7.3. Why Use FeedSync?
    4. 7.4. How Does FeedSync Work?
      1. 7.4.1. Conflict Detection and Resolution
    5. 7.5. Producing RSS and Atom Feeds Using Managed and Unmanaged Code
      1. 7.5.1. Managed Code
      2. 7.5.2. Unmanaged Code
    6. 7.6. Consuming RSS and Atom Feeds Using Managed and Unmanaged Code
      1. 7.6.1. Managed Code
      2. 7.6.2. Unmanaged Code
    7. 7.7. Converting IDs and ItemData
    8. 7.8. Summary
  14. 8. Sync Services for ADO.NET 2.0: Offline Scenarios
    1. 8.1. Occasionally Connected and Peer to Peer Systems
      1. 8.1.1. Smart Clients As Durable Subscribers
    2. 8.2. Offline Scenarios Architecture
      1. 8.2.1. Sync Services for ADO.NET Components 2.0
      2. 8.2.2. Choosing Sync Services for ADO.NET 2.0 over ADO.NET Data Access
      3. 8.2.3. Synchronization Types for Occasionally Connected Systems
    3. 8.3. Code Examples of Common Tasks
      1. 8.3.1. Exploring the Sync Services for ADO.NET 2.0 API
      2. 8.3.2. Local Database Cache Using Visual Studio 2008
      3. 8.3.3. Enabling Change Tracking in a Server Database
      4. 8.3.4. MySync.sync
        1. 8.3.4.1. QuoteSyncTable Class
        2. 8.3.4.2. MySyncSyncAgent Class
        3. 8.3.4.3. MySyncClientSyncProvider Class
        4. 8.3.4.4. MySyncServerSyncProvider Class
        5. 8.3.4.5. QuoteSyncAdapter Class
      5. 8.3.5. Complete Synchronization Code Sample
      6. 8.3.6. Synchronization Direction
      7. 8.3.7. Synchronize Command
      8. 8.3.8. SyncStatistics
    4. 8.4. Summary
  15. 9. Synchronization Services for ADO.NET 2.0: Peer-to-Peer Synchronization
    1. 9.1. Collaboration Scenario: Peer-to-Peer Synchronization
    2. 9.2. Sync Services for ADO.NET 2.0 APIs for Collaboration
      1. 9.2.1.
        1. 9.2.1.1. Two-Tier Synchronization
          1. 9.2.1.1.1. Peer Database
          2. 9.2.1.1.2. Change Tracking Table
          3. 9.2.1.1.3. Sync Adapter
          4. 9.2.1.1.4. Sync Provider
          5. 9.2.1.1.5. Sync Agent
          6. 9.2.1.1.6. Sync Application
        2. 9.2.1.2. N-Tier Synchronization
      2. 9.2.2. Sync Proxy
      3. 9.2.3. Sync Service
    3. 9.3. Sample Application for Two-Tier Peer-to-Peer Synchronization
      1. 9.3.1. Database Structure for the Sample Application
      2. 9.3.2. Peer-to-Peer Synchronization Tasks
      3. 9.3.3. Additional Tasks
    4. 9.4. Solution Structure of the Sample Peer-to-Peer Sync Application
      1. 9.4.1. Implementing Change Tracking and Change Enumeration
      2. 9.4.2. Configuring the Sync Adapter
        1. 9.4.2.1. SyncAdaperCommandHelper Class
          1. 9.4.2.1.1. Data Commands (Account):
          2. 9.4.2.1.2. Metadata Commands (Account_Tracking)
          3. 9.4.2.1.3. SyncAdapterHelper Class
      3. 9.4.3. Configuring the Sync Provider
        1. 9.4.3.1. SyncProviderCommandHelper Class
        2. 9.4.3.2. SyncProviderHelper Class
      4. 9.4.4. Synchronizing the Application
      5. 9.4.5. Form Load
      6. 9.4.6. Synchronizing Peers
      7. 9.4.7. Reporting Sync Progress
      8. 9.4.8. Executing Operations
      9. 9.4.9. Running the Application for Two-Tier Peer-to-Peer Synchronization
      10. 9.4.10. Handling Conflicts
      11. 9.4.11. Cleaning Metadata
      12. 9.4.12. N-Tier Peer-to-Peer Synchronization
      13. 9.4.13. Creating the Remote WCF Service
      14. 9.4.14. Adding a Service Reference
      15. 9.4.15. Creating a Local Proxy
      16. 9.4.16. Nonimplemented Methods
      17. 9.4.17. Configuring a Sync Agent for N-Tier Synchronization
      18. 9.4.18. Running the Application
    5. 9.5. Summary
  16. A. Sync Framework Library Reference
    1. A.1. Microsoft.Synchronization Namespace
    2. A.2. Microsoft.Synchronization.Files Namespace
      1. A.2.1. FileSyncProvider Class
      2. A.2.2. FileSyncScopeFilter Class
    3. A.3. Microsoft.Synchronization.Data Namespace
    4. A.4. Microsoft.Synchronization.FeedSync Namespace
    5. A.5. Microsoft.Synchronization.MetadataStorage Namespace

Product information

  • Title: Pro Sync Framework
  • Author(s):
  • Release date: November 2008
  • Publisher(s): Apress
  • ISBN: 9781430210054