Demo II: Offline Application – TSQL+SProc

In the first demo, I showed you how to quickly build an offline application by using SyncAdapterBuilder to generate db commands needed for bidirectional sync on the server side. For the client side, we did not have to do anything except defining the tables of interest and the db connection to the local SQLCE database. SQLCE 3.5 and the SyncClientProvider took care of all sync magic for us. As a reminder, the SyncAgent is the orchestrator of the sync processing between ClientSyncProvider and ServerSyncProvider and where the Synchronize() method is exposed.

While SyncAdapterBuilder is a pretty useful utility, it hides some sync logic that I believe is important to understand so that you can expand on the basic commands shown in theses demos and add custom logic to address your real world scenarios better. In this demo, I want to show you how to write a SyncAdapter using TSQL statement or SProcs which you will need to create on the server database. To show you both, I decided to write TSQL statements for enumerating changes and SProcs for applying changes.

One key thing to take away from this demo is the new session parameters. Session Parameters are built-in parameters that you will need to write your sync commands. The value of these parameters is set by the SyncServerProvider during sync. The names of all built-in session parameters are exposed via SyncSession class.

How to install OfflineAppDemo application?

  • Fire SQL server management studio and load demo.sql file
  • Execute the script until the "test sample" marker
  • Load server_procs.sql file and execute it to install server procs
  • Load VS solution (OfflineAppDemo-TSQL+SProc Project)
  • Build the project
  • You are ready to go

Download Now
Feedback
: Visit Sync Services Forum

Update: Just to let you know, I left Microsoft to start a new company, Raveable Hotel Reviews. See examples: Romantic Hotels in NYC , Best Hotels in Seattle , Top 10 Hotels in Myrtle Beach , Kid Friendly Hotels in Chicago , Hotels with in-room jacuzziand Best Hotels in Miami. Your feedback is welcome on twitter.com/raveable, raveable blog.