Friday, March 02, 2007

Documentation for SQL Server CE 3.5 Sync Demos

Rafik Robeal has posted detailed, illustrated documentation for the four SQL Server 3.5 synchronization demos to his SyncGuru Web site. My January 26, 2007 Microsoft Releases Synchronization Services CTP, Three Sample C# SSCE Sync Services Projects, and Conflict Resolution with Sync Services posts describe the demos and related Sync Services technologies.

Here's Rafik's description of the four projects with links to the documentation:

  • Demo I : Automatic Generation of SyncAdapterBuilder This demo shows the quickest way to build offline application for bidirectional synchronization. It focuses on the use of SyncAdapterBuilder to generate all necessary commands needed for two way sync. An important part of the demo is the need to prepare the backend database for synchronization. The demo shows few steps to setup change tracking for every table we wish to synchronize with the client. It also show how to track deletes by populating a separate tombstone table using delete triggers.
  • Demo II : Authoring SyncAdapter Objects using TSQL and SProcs This demo continues where 'Demo I' left off. It shows that while coding SyncAdapter manually might be a lot of code, it easy to do with the added benefit if better performance. The demo also shows "session parameters" which is a new concept in Sync Services. Session parameters are built in variables that you can and will use as parameters to your commands. The sync runtime job is to set the value of these parameters for you. When writing SyncAdapter, you need to understand which parameters you need and how to use them in your queries or procs. To show you both, I put wrote the Insert, Update and Delete commands as stored procedures and the enumeration commands as TSQL.
  • Demo III : N-Tier Setup Using Web Services Things get exciting when you throw web services into the mix. In this demo, I took the server side and put it away in the mid tier where you can access it through web service only. The process is rather mechanical, the tricky part though is to get around type sharing issues when referencing the web service in the client application.
  • Demo VI : Conflict Detection and Resolution Back to two-tier setup, this demo shows a relatively annoying side effect of lazy synchronization which is conflicts. The annoyance of conflicts is rather clear, on one hand end user hates conflicts, on the other hand developers are unable to decide how to deal with them. The demo does not give a magic solution to this problem, if one exists! It shows, however, how to plug into framework to write detect conflicts and surface them to the end user or custom logic. It also shows several possible options for resolving conflicts. Pay special attention to the sync_force_write session parameter as it is the key to conflict resolution on the backend database.

SQL Server CE and Sync Services in the Orcas March 2007 CTP

Orcas March 2007 CTP installs the SQL Server 2005 Compact Edition (SSCE) 3.5 CTP, SSCE 3.5 Design Tools CTP, and SSCE 3.5 for Devices CTP. Online Help's Development Tools\Visual Studio\.NET Framework\Accessing Data\Creating Client Data Applications node has "Using SQL Server 2005 Compact Edition" and "Occasionally Connected Applications" topics. The latter topic includes a link to download the Synchronization Services for ADO.NET Books Online CTP and Rafik's first demo.

Update 3/8/2006: The Synch Designer IS in the Orcas March 2007 CTP

However, you won't find Right-click your project in Solution Explorer, click Add, New Item to open the Add New Item dialog, and choose Local Database Cache to start the the Sync Designer that Steve Lasker promised for the "February CTP" in his January 23, 2007 Sync Services for ADO.NET (OCS) CTP Now Available post:

The Visual Studio Orcas CTP's will include SQLce 3.5, the sync runtime, along with the Sync Designer. At this point the Feb CTP of Orcas will be the first public release of the sync designer. I'll post a screencast of the designer soon. But realize the Orcas downloads are quite large.

(Steve isn't kidding about Orcas downloads being large.)

It's unfortunate that the Sync Designer isn't included in the March CTP because, as Rafik's projects demonstrate, writing sync services code isn't a walk in the park. Here's a Web page with screen captures for the steps to add a Sync Designer to a WinForm project.

Recent Synchronizer Blog Posts

Rafik added the following Sync Services posts recently: