Using MS Sync Framework to synchronize two SQL CE Dbs

拥有回忆 提交于 2019-12-01 01:28:03

问题


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?


回答1:


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.




回答2:


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!



来源:https://stackoverflow.com/questions/581110/using-ms-sync-framework-to-synchronize-two-sql-ce-dbs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!