c# - Sync Framework - 在不更改架构的情况下同步数据

标签 c# sql-server-2008 synchronization microsoft-sync-framework

有没有一种方法可以在不实现所需的架构更改(“_tracking 表”)的情况下使用 Microsoft Sync Framework。基本上,我面临着同步两个 SQL Server 2008 数据库的任务,其中一个是遗留数据库,我们无法对其进行任何架构更改。

是否可以将每个数据库所需的附加表存储在单独的数据库中?

例如我有 3 个表需要同步(员工、客户和销售),通常我们只添加三个额外的跟踪表,但这是不可能的。相反,我能否拥有一个包含所需跟踪表(Staff_tracking、Customer_tracking、Sales_tracking)的单独数据库,并以某种方式将同步框架指向这个新数据库?

感谢任何帮助,最好有代码示例!

最佳答案

由于您使用 SQL 2008 作为数据库,只需打开更改跟踪并让 SQL Server 在内部为您跟踪更改表,而无需更改实际客户端数据库的架构。 MSDN 在 this article 中对其进行了很好的解释.大约一半的地方,你会看到以下内容:

SQL Server 2008 has introduced a new alternative method for tracking changes called SQL Server 2008 Change Tracking. The concept behind change tracking is that an administrator marks certain tables to be monitored for changes. From that point SQL Server 2008 keeps tracks of any inserts, updates, or deletes that are made. When a remote “requestor” requests changes, SQL Server 2008 will provide all of the changes that have occurred since the last successful download as specified by the requestor. The Sync Framework database synchronization providers have been built to take advantage of SQL Server 2008 change tracking and provide the following advantages for an OCA environment:

  • No schema changes are required to be able to track changes.

假设您使用的是标准的 Microsoft 同步提供程序,默认情况下包含更改跟踪支持。

关于c# - Sync Framework - 在不更改架构的情况下同步数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8577174/

相关文章:

sql - 如何将UNION查询结果移动到新表?

c# - FormsAuthenticationTicket 不能在服务器端失效。引起 cookie 回复攻击

sql-server-2008 - bcp 如何比 SSMS 更快地将简单查询结果写入磁盘?

C#:捕获多个图像并保存在同一个文件夹中?

sql - 在 then of case when 语句中选择子查询?

c# - 为什么锁确保底层监视器被释放而直接使用监视器却没有?

python - 使用python实时SQLite和PostgreSQL双向同步

synchronization - CUDA 线程围栏

c# - 无法在 C# 中解析 JSON 响应

c# - 必填字段验证器停止图像按钮 onclick?