Synchronizing SQL Server and SQL Server Compact
The topics in this section provide background information, procedural content, and complete code examples for common synchronization tasks that you can perform by using Sync Framework. The topics are designed to demonstrate how SQL Server databases (including SQL Server Express and SQL Server Compact) can be synchronized by using Sync Framework. For information about synchronizing non-SQL Server databases, see Synchronizing Other ADO.NET Compatible Databases.
In This Section
Advanced Synchronization Scenarios for SQL Server and SQL Server Compact
Synchronization Management for SQL Server and SQL Server Compact
Example Applications in the How-to Topics
Each how-to topic contains a console application. This application is written in both C# and Visual Basic and demonstrates particular features of the API. Although it is quicker to show only code examples for a specific task or feature, it is much easier to understand how Sync Framework works if you see a particular feature in a fairly complete context.
Each application contains the following classes:
Program This class sets up synchronization and calls methods from the Utility class. The Utility class handles all functionality that is not directly related to synchronization, such as holding connection string information and making changes to the databases involved in synchronization.
SampleSyncOrchestrator This class, which is derived from SyncOrchestrator, sets synchronization options and displays statistics.
The code for all the applications has been tested on Visual Studio 2008 and SQL Server 2008.
To run each application
Execute the "Tables for SQL Server Collaborative Scenarios" Transact-SQL script in Setup Scripts for Database Provider How-to Topics. This script creates three databases, with a set of tables in the first database.
Copy the Utility class code from Utility Class for Database Provider How-to Topics. Paste this code into each application that you want to run, or create a DLL from the code and reference that DLL from each application. The database connection strings in this class use localhost for the database name. Update the database name if necessary.
Add references to the following DLLs:
Microsoft.Synchronization.dll
Microsoft.Synchronization.Data.dll
Microsoft.Synchronization.Data.SqlServer.dll
Microsoft.Synchronization.Data.SqlServerCe.dll and System.Data.SqlServerCe.dll
関連項目
概念
Architecture and Classes for Database Synchronization