Visual Studio 2008 SP1: Sync Services for ADO.Net with SQL Server 2008 Change Tracking (转)

时间:2023-01-21 09:41:31
原文: http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/05/12/sync-services-for-ado-net-with-sql-server-2008-change-tracking.aspx

One of the main pillars of Visual Studio 2008 and .Net Framework 3.5 Service Pack 1 if the better integration with SQL Server 2008. Service Pack 1 now uses the Change Tracking capabilities of SQL Server 2008 in order to identify the incremental changes.

During the process of writing this post, I am building a simple application with both Visual Studio 2008 and Visual Studio 2008 + SP1 in order to spot the changes in Sync Services for ADO.Net in SP1.

The first thing you notice when you add a new Local Database Cache item, is the Use SQL Server change tracking checkbox. The wizard knows that the connection on the server side was a SQL 2008 connection, and then enabled this checkbox.

Visual Studio 2008 SP1: Sync Services for ADO.Net with SQL Server 2008 Change Tracking (转)

When this option is enabled, and you click on the add button in order to select the tables you would like to synchronize, the database schema doesn't need to be changed like it used to be in earlier versions besides enabling the change tracking at the level of the database and each table you want to synchronize.

Visual Studio 2008 SP1: Sync Services for ADO.Net with SQL Server 2008 Change Tracking (转)

You can notice in the screenshot above that the Script Generation section of this page is missing. This is because those script are not only at the level of each table, but also at the level of the database itself, where you'd want to enable the change tracking.

When you confirm the Configure Data Synchronization Wizard, you will get the following message:

Visual Studio 2008 SP1: Sync Services for ADO.Net with SQL Server 2008 Change Tracking (转)

This message replaces the missing script generation section at the table level and when you confirm it, it will generate the scripts for each table and for the database.

Visual Studio 2008 SP1: Sync Services for ADO.Net with SQL Server 2008 Change Tracking (转)

But the difference is, that instead of generating a long script that adds several columns and a tombstone table, it only enabled the change tracking at the database level and at the table level.

Summary

Sync Services for ADO.Net in Visual Studio 2008 SP1 now uses SQL Server 2008 Change Tracking and has the tools support for it. When you use a SQL Server 2008 connection, you don't have to change the database schema but to enable change tracking.

Enjoy!