Overview and Scenarios

Sync Framework enables synchronization between databases. It provides an intuitive and flexible API that enables you to build applications that target offline and collaboration scenarios. The API enables you to use all or only some of the components that are provided, depending on the architecture and requirements of an application. Sync Framework supports client-server, client-to-client, and mixed topologies. In client-server topologies, all clients synchronize with a central server. In client-to-client topologies, each client can synchronize with another client without changes having to go through a central server. Mixed topologies consist of a combination of client-to-client and client-server topologies.

Synchronization Scenarios

The ability to support mobile and remote workers is becoming more important for organizations every day. It is very important for organizations to make sure that workers have access to the same information that they have when they are in the office. In most cases, these users will have a laptop, office desktop, smartphone, or PDA. From these devices, users can sometimes access data by using a VPN connection or some other method of connecting directly to the corporate network. For most remote users, this solution is less than satisfactory because of major disadvantages in the following areas:

  • Network requirements

    To enable users to access information, the remote device must have a constant connection to the corporate network while it is accessing data. For some workers, such as those who are working from home, this might not be a problem. For other users, such as salespeople who are constantly on the move, this could be more difficult. For example, if a salesperson is visiting a customer and cannot access inventory data because there is no network connectivity, the salesperson cannot effectively do her job.

  • Data access speeds

    In a typical client-server corporate environment, users have high speed networks that enable quick access to information. However, remote workers are often connected over slow, unreliable networks. By using a typical solution, every piece of data that a user wants must be downloaded every time that it is requested, because there is no way to persist the data on the device. For example, if a salesperson must download his product list every time he opens his application, the time lag required to populate the application with information could be frustrating.

  • Single point of failure

    With this kind of solution, users often rely on a single server database. If that database is not available because of planned server downtime or from server failures, all remote workers will be disconnected from their data.

  • Server scalability

    As more people work remotely, the performance of the corporate servers will be affected, and more hardware might have to be added.

Occasionally Connected Applications

An alternative to the solution described in the previous section is to implement an occasionally connected application. An occasionally connected application still enables a remote worker to access data, but the information that she wants is stored locally. To populate a local database, an occasionally connected application typically uses data synchronization.

Data synchronization consists of the ability to periodically take information that is stored in one database (such as a client database) and synchronize changes with another database (such as a server database). A synchronization-based solution offers the advantage that a user no longer has to have a constant network connection to access information. Because the data is stored locally, a user has constant access to the data while processing is offloaded from the central database. Additionally, because the speed of the network is no longer a limiting factor, a user can now access the data at the speed of the local computer.

Client-to-client synchronization avoids the single point of failure by enabling synchronization that does not rely on all changes going through a server. The ability to push a lot of the application processing to each client also helps to address the issue of server scalability.

Sync Framework uses synchronization providers to communicate with each database that is synchronized. The Sync Framework database providers, which are analogous to ADO.NET data providers, shield other Sync Framework components from the specific implementation of each database. Sync Framework includes five database providers, which support two types of scenarios: offline and collaboration scenarios. The following illustration shows an offline scenario: in a client-server topology, clients connect to a central server to synchronize data when a connection is available.

Sync Services offline scenario

A common extension to this kind of occasionally connected application is the ability to support collaboration scenarios. These are scenarios in which two databases can be synchronized peer-to-peer without having to go through a central hub. The following illustration shows a mixed topology in which a central server synchronizes with clients, and the clients are able to synchronize with each other. A topology like this could support an application that allows users to share project notes. Project team members often require a local copy of data that they can work with. When they have made changes, they can synchronize with a server to upload changes or with another team member to exchange changes.

Sync Services collaboration scenario

The five database synchronization providers that Sync Framework includes can be divided into two categories:

  • DbServerSyncProvider and SqlCeClientSyncProvider support offline scenarios. These providers have the following characteristics:

    • Suitable for client-server topologies.

    • Always used as a pair. For example, you cannot synchronize two server databases by using two instances of ServerSyncProvider (use SqlSyncProvider or DbSyncProvider instead).

    • Can be less complex than the collaboration providers, but they cannot participate in topologies with other Sync Framework providers.

    For more information about offline synchronization, see Offline Scenarios.

  • SqlSyncProvider, SqlCeSyncProvider, and DbSyncProvider support collaboration scenarios. SqlSyncProvider and SqlCeSyncProvider are used, respectively, to synchronize SQL Server and SQL Server Compact databases. DbSyncProvider is typically used to synchronize non-SQL Server databases. These providers have the following characteristics:

    • Suitable for peer-to-peer and mixed topologies. Can be used in client-server topologies if more advanced features are required, such as complex batching.

    • Can be used in more flexible ways. For example you can synchronize two instances of DbSyncProvider, or one instance of SqlSyncProvider and one instance SqlCeSyncProvider, and so on.

    • Use Sync Framework metadata and can participate in topologies with other Sync Framework providers.

    For more information about data collaboration, see Collaboration Scenarios.

See Also