具有多个客户端和服务器数据库的 Microsoft 同步框架
我正在对应用程序进行更改,以拥有本地数据存储,而不是直接连接到数据库服务器。然后,客户端应用程序将在服务器数据库与其本地数据存储之间双向同步更改。我正在尝试使用 Microsoft Sync Framework 实现同步解决方案。需要明确的是,没有服务器应用程序,只有数据库服务器,但有多个客户端。
我已经开始实现两个实现 FullEnumerationSimpleSyncProvider 的类,一个称为 LocalSyncProvider,一个称为 ServerSyncProvider。 LocalSyncProvider 知道如何从本地数据存储中枚举、插入、更新和删除项目,ServerSyncProvider 知道如何从数据库服务器枚举、插入、更新和删除项目。它们各自使用提供的 SqlMetadataStore 并将两个元数据存储(一个用于本地,一个用于服务器)存储在客户端的本地驱动器上。这意味着每个客户端都将拥有自己的本地数据存储元数据存储和服务器数据库元数据存储。
这实际上可行吗?是否只需要存在一个服务器元数据存储,或者我是否需要以不同的方式使用同步框架?
I'm working on changes to an application to have a local data store instead of connecting directly to the database server. The client app will then sync changes both ways between the server database and its local data store. I'm trying to implement the syncing solution using Microsoft Sync Framework. To be clear there is no server application, only the database server, but there are multiple clients.
I have started implementing two classes that implement FullEnumerationSimpleSyncProvider, one called LocalSyncProvider and one called ServerSyncProvider. The LocalSyncProvider knows how to enumerate, insert, update, delete items from the local data store, and the ServerSyncProvider knows how to enumerate, insert, update, delete items from the database server. They each use the provided SqlMetadataStore and store the two metadata stores (one for the local and one for the server) on the local drive of the client. This means that each client will have its own metadata store for its local data store and its own metadata store for the server database.
Is this actually going to work, does there need to exists only one server metadata store, or do I need to be using the Sync Framework differently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们正在使用类似的方法,它的工作原理正如您所描述的那样。不同之处在于,我们使用客户端的
FileSyncProvider
和服务器的FullEnumerationSimpleSyncProvider
实现来同步文件,而不是数据。但是我们没有在服务器上运行同步框架代码,并且有两个单独的元数据文件,都存储在客户端上。然而,我最近遇到了一个你可能想知道的问题。看来,如果客户端上的元数据存储被删除,同步框架将无法重建元数据文件,而不会被服务器上已有的数据/文件混淆。
We are using a similar approach and it works as you described. The difference is that we are syncing files, not data, using the
FileSyncProvider
for the client and an implementation ofFullEnumerationSimpleSyncProvider
for the server. But we have no Sync Framework code running on the server and there are two seperate metadata files, both stored on the client.However, I have recently come across a problem which you might want to be aware of. It seems that if the metadata stores on the client are deleted, the Sync Framework can't rebuild the metadata files without getting confused by data/files that are already on the server.