To perform synchronization, the developer writes code that does the following:
- Initiates a synchronization session
- Sets up references to two synchronization providers and configures them appropriately
- Starts the synchronization process
Each client or server store holds information about the changes occurring in that store. This metadata, stored local to and available to
each provider, contains the knowledge used by the provider to detect changes and conflicts. The Sync Framework includes a small footprint metadata store service that developers can use when implementing custom providers. Alternatively, developers can implement the metadata
functionality as part of the local data store. An example is the offline store provider for Silverlight web applications and Windows phone 7 applications.
Data converters are required if the format of the data is different between the two data stores, and if the existing providers or your custom providers do not expose data in OData Sync format. For example, if one store exposes ADO.NET DataSets and the other exposes data in XML format, the developer can create a pair of data converters and specify these when setting up the synchronization process. If there are many data store formats, it may be easier to create data converters that convert to and
from a common format, and then to use the appropriate pair for each synchronization session.
Events are raised during the synchronization process to indicate the individual changes occurring and any errors that arise (including
conflicts if the data in both locations has changed). The application can handle these events to provide status information to the user,
manage conflicts by applying business rules (such as “latest change wins”), and to display the results.
For a useful introduction to the synchronization process and details of the way that synchronization metadata is used, see “Introduction
to Microsoft Sync Framework” on MSDN (http://msdn.microsoft.com/en-us/sync/bb821992.aspx). This article discusses the metadata used by the framework, the synchronization flow, and includes examples of synchronization with and without update conflicts.