Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MS Sync Framework to synchronize two SQL CE Dbs

I'm just working into the Microsoft Sync Framework. It looks quite easy to sync a local SQL CE 3.5 Database with a remote SQL Server 2008 using the SqlSyncAdapterBuilder and SqlServerChangeTracking.

Unfortunately, syncing two SQL CE 3.5 Databases doesn't look that easy...
The documentation is very sparse, and I don't realy know how to get started here.

My concrete scenario looks like the following:

  • I have one central SQL Server 2008.
  • Multiple clients are connected to this server (some of them only partially).
  • Those (partially connected) clients are using multiple applications (maybe running concurrently) working on the same data base.

Syncing the clients with the central server should be no problem. Syncing the multiple applications on an offline-client is where I've thought of using multiple SQL CE databases (one as a server, and one for every application-instance). I'd really appriciate being able to use the same conflict-resolution mechanisms when syncing the clients with the server and also when syncing multiple applications on the client. Installing a SQL Server 2008 Express on every client is a no-go.

Does anyone have some experience with syncing two SQL CE databases?

like image 639
Thomas Danecker Avatar asked Feb 24 '09 09:02

Thomas Danecker


2 Answers

Sync Framework 2.0 allows synchronization between SQL Server Compact Edition databases.

SqlCeSyncProvider is used to synchronize SQL Server Compact databases.

This provider can be used to synchronize with a central server but also has the ability to synchronize with other clients, which is not possible with SqlCeClientSyncProvider. This ability enables developers to target new scenarios such as a collaboration scenario in which teams of people need to synchronize among each another in the absence of a connection to a central server.

like image 148
Scott Munro Avatar answered Oct 11 '22 21:10

Scott Munro


All ado.net syncs require a client provider and a server provider.

Sadly, there isn't a SqlCeServerSyncProvider out of the box with the current version of the framework. What that means is that you have to subclass DBServerSyncProvider and wrap a SqlCeClientSyncProvider.

See this article for an example on how to do it with sql express.

It's the same concept, just that you'll be wrapping the SqlCeClientProvider. The good news is that the wrapping might be easier.

Good luck!

like image 24
matt eisenberg Avatar answered Oct 11 '22 20:10

matt eisenberg