Synchronization made Easy by the Sync Framework
Last November, Microsoft announced the
Sync Framework project. The framework comes to the rescue of an overlooked area: the complex world of data synchronization. This is achieved by merging existing technologies in a common interface, which can be easily extended using new sync providers. The current implementation supports providers for file synchronization, ADO.NET and
FeedSync. It is interesting to see how these providers interact with the different type of participants:
Full Participants: These participants initialise and host the sync framework, triggering the synchronization and configuring the providers. The full participant is able to communicate with any other type of participant building synchronization networks. A good example can be a desktop application or a service managing a mesh of participants.
Partial Participants: These participants are passive members that can store information as well as alter it but do not know anything about the synchronization framework. They end up being only repositories that may be available when a full participant requests the synchronization; this means that they cannot participate without a full partner. A good example is a digital camera or an mp3 player.
Simple Participants: These only feed information into the synchronization but are not able to store information. A full participant will request data from simple participants and will synchronize with the other members. An example can be a RSS feed.
The architecture of the framework is divided in two basic components: the first part is the framework's implementation located in the
Microsoft.Synchronization namespace and the second part is sustained by the providers, implemented in separate assemblies. This model allows the developers to extend the providers to fulfil custom requirements, either using the providers as base code or creating completely new ones. For more on the Microsoft.Synchronization assemblies, please read the
online documentation.
Each of the providers can be configured individually using the
SyncOptions and the
SyncScopeFilter classes, which provide developers the ability to shape the behaviour, e.g. what files should be included on the synchronization. The providers have the freedom to publish methods to enforce those options and construct the metadata information, which enumerates the changes since the last synchronization. Once we have this metadata setup, the sync framework takes control after we call the SyncAgent.Synchronize
() method. During execution the full participant may handle progress events in order to query the status of the metadata synchronization, providing a richer user experience. This process is the same no matter what kind of content is synchronized and it is upon the providers to hide the internals of the implementation.
As I hope you can see, using the sync framework is an easy and powerful exercise that helps you implement heterogeneous synchronization in your applications. For more information, please visit the sync developer centre where you can find an
active community already utilising this technology!
Salvador Alvarez Patuel
Application Development Consultant (ADC)Read Salvador's blog