lutya - Fotolia

Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Understanding the Microsoft Sync Framework

An expert explains the Microsoft Sync Framework, a platform for synchronizing heterogeneous data distributed across applications, services and devices.

The Microsoft Sync Framework is a comprehensive platform for synchronizing heterogeneous data distributed across applications, services and devices. The framework provides built-in support for SQL Server technologies, including on-premises SQL Server, Azure SQL Database and SQL Server in an Azure virtual machine (VM). The framework also supports a wide range of other data sources and can be extended to proprietary solutions.

With the Microsoft Sync Framework platform, organizations can build a diverse ecosystem that enables collaboration and facilitates offline operations, while being able to synchronize local and remote services. The platform provides a set of robust APIs and providers to complement its built-in syncing and change-tracking technologies, making it possible to support a variety of protocols, topologies and different data source types.

An overview of the Microsoft Sync Framework

Developers can use the Sync Framework to build rich applications that leverage SQL Server and other technologies in order to provide their users with the type of data they need, when and where they need it. The framework is designed to support occasionally connected applications (OCAs) that enable roaming and sharing across disparate and distributed endpoints.

With Sync Framework, you can use existing architectures and protocols to create an integrated sync platform built on transport-agnostic architecture suitable to multiple network topologies. The framework supports connectivity with heterogeneous databases as well as synchronization over different transports or services, such as Windows Communication Foundation (WCF).

At the core of the Sync Framework is a sync runtime that provides universal synchronizing capabilities across all data types and protocols. The framework also makes it possible to create and consume FeedSync-compliant feeds. FeedSync is a multi-master synchronization algorithm and set of data extensions to the RSS and Atom feed formats.

An important component of the Microsoft Sync Framework is the participant, a location where a data source is available for syncing. This can be a laptop, USB thumb drive or Internet service. A full participant is one that can launch executables and store data, such as a smartphone or personal computer. A partial participant is one that can store data, but not launch executables, and can include such devices as thumb drives or SD cards.

A simple participant can provide data, but cannot store it or launch an executable. Simple participants supply data such as Web services or RSS feeds. For example, eBay and Amazon can be considered simple participants.

The Sync Framework supports all three participant types by offering an extensible provider model that integrates data sources into the platform. Through the providers, any data source can participate in the synchronization process. The Sync Framework includes a number of built-in providers that support common data sources, including SQL Server, but developers can also create custom providers.

The data sources themselves can be anything from a relational database to a file on a hard disk to an app's custom data store. The Sync Framework supports a rich metadata model that maintains the information necessary to support collaboration and offline operations, regardless of the type of data or network topology.

SQL Server and the Sync Framework

In today's world of mobility, the need for flexible and efficient data access is greater than ever. The old model of users having direct and continuous access to a centralized database no longer meets the needs of multi-device mobile solutions. For this reason, many organizations are turning to the OCA model to meet their data needs. The OCA lets users store and access their data locally when they need it. The local data is then periodically synchronized with the central database.

With an OCA, users no longer need to maintain constant network connections in order to conduct business. They have continuous access to the data on their own devices, while offloading the bulk of the processing to the centralized server. This model also can be extended to remote workgroups that maintain their own data stores, which get synced periodically with the main data center.

The Microsoft Sync Framework can support a variety of OCA topologies, including client-server, client-client or a mix of the two. In the client-server model, all endpoints synchronize with a central server, and in the client-client model, endpoints sync directly to each other, without going through a central server. With either topology (or a mix of the two), the Sync Framework can facilitate offline operations and collaboration through its syncing capabilities.

The Sync Framework includes the APIs and providers necessary to build OCAs that incorporate ADO.NET-enabled databases, making it possible to synchronize data between those databases and other Sync Framework sources, including file systems, Web services and custom data stores. The Sync Framework providers can take advantage of change tracking technologies, without requiring database triggers or schema changes. The framework also includes the functionality necessary to detect and resolve conflicts as well as synchronize data on an upload-only, download-only or table-by-table basis.

A closer look at SQL Server synchronization

The Sync Framework provides built-in support for SQL Server 2005 SP2 or later and SQL Server Compact 3.5 SP2 or later, whether implemented on premises or within an Azure VM. The Sync Framework also can be used in conjunction with Azure SQL Database.

To facilitate the synchronization process, the Sync Framework includes an orchestrator that determines the order and direction for applying changes. In addition, the orchestrator maintains session level information about the status and success of the sync operations.

The framework also uses providers to communicate with each participating database. The providers segregate the database implementation specifics from the rest of the Sync Framework components to provide a unified approach to data access regardless of the data source.

The Sync Framework includes five database providers. The three primary providers support offline and collaboration scenarios within client-server, client-client and mixed topologies. Developers can combine providers in different ways as well as synchronize them with other provider types. Each of the three main database providers is specific to a product type: one for SQL Server databases, one for SQL Server compact databases and one for other relational database systems.

The other two providers support offline operations only and have been superseded by the first three. The Sync Framework includes them only to support legacy applications.

The Microsoft Sync Framework and its support for SQL Server databases and other data sources could prove to be a useful technology for organizations that want to implement OCA applications. Developers can create robust solutions that use SQL Server in the back end to support the data needs of various devices. In many cases, the out-of-the box providers will meet their development needs, but if those providers aren't enough, they can build custom providers. An organization can then have a synchronization solution that supports collaboration and offline access across services, devices and applications.

Next Steps

Learn about collaboration tools in the Analytics Platform Services

Learn about synchronization in the world of online gaming

Dig Deeper on Microsoft SQL Server Tools and Utilities