使用 Microsoft Sync Framework 2.1 同步整个数据库
我需要能够将多个远程数据库与我的主数据库同步、上传和下载。
然而,问题在于我需要同步整个数据库,并且数据库模式将不断更新,并且我没有看到任何方法对其进行编码以获取整个数据库模式而不添加每个单独的数据库模式表到 SyncScope
。
这是有问题的,因为范围总是在变化。我解决了删除现有范围并添加新范围的最初问题,但我仍然找不到任何简单的解决方案,无需查询系统表,解析结果,并将这些结果(150+)表传递回我的 <代码>SyncScope。
我最初考虑同步框架的原因是:
- 当我通过 C# 通过单击按钮以编程方式执行同步时,我需要能够管理同步的方向(上传/下载)。
- 我需要能够根据他们的网络连接打开该按钮。
- 同步下载还需要完成其他任务,例如更改移动设备的连接字符串,以及将有关其连接和设备的信息存储在数据库中。
- 同步上传时还需要运行其他任务,例如通过我的 OR/M 根据客户业务规则验证数据、将数据存档到网络存储、重新启动应用程序以及再次更改连接字符串。
- 最终,我需要部分数据集,由客户在运行时、对象级别、OR/M 框架中决定/选择。这些对象可能与我在设计时不知道的一个或多个表一致,或者甚至可能在设计时不存在。
有谁知道另一个框架是否包含我的所有要求,或者是否有更简单的方法在同步框架中执行此操作?
I need the ability to sync multiple remote databases, upload and download, with my main database.
However, the problem lies in the fact that I need to sync the entire database, and the database schema is going to be being updated constantly, and I didn't see any way to code it to grab the entire database schema without adding each individual table to the SyncScope
.
This is problematic as that scope will always be changing. I solved the initial problem of removing the existing scope, and adding a new one, but I still cannot find any simple solutions, without querying system tables, and parsing the results, and passing those results (for 150+) tables back to my SyncScope
.
The reasons I originally looked at Sync Framework are:
- I need to be able to manage the direction of the sync (upload/download) when I do a sync programatically from C# on a button click.
- I need the ability to turn on that button, based off their network connectivity.
- There's additional tasks that need to be done on a sync download, such as changing connection strings of the mobile units, and storing information about their connection and unit in the database.
- There's additional tasks that need to be run on a sync upload, such as verifying data against customer business rules through my OR/M, archiving the data to a network storage, restarting the application, and changing connection strings again.
- Eventually, I need partial data sets, decided/chosen by the customer, at run-time, at the object level, in an OR/M framework. These objects, may coincide with one or more tables I won't know of at design-time, or may not even exist at design-time.
Does anyone know if another framework encompasses all my requirements, or if there is a simpler way to do this in the sync framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于此任务,尤其是在架构发生变化的情况下,您可以考虑合并复制而不是同步框架。
For this task, especially with a changing schema, you could consider Merge Replication instead of the Sync framework.