Sync Framework and add columns

一世执手 提交于 2019-12-12 03:57:10

问题


Well, i'm probing Sync Framework 2.1. It worked great, until i altered a table and added a column. There's a lot written about the theme. Here is my approach

  1. Alter table and add a column in the databases (master, and slaves)
  2. rename tracking tables (ex, from todos_tracking to todos_tracking_back)
  3. Drop the original providing scope
  4. create a new scope with the same name as the former, skipping the creation of tracking tables
  5. rename tracking tables to the original name (ex, from todos_tracking_back to todos_tracking)

All of this it just for no losing the track of changes. Spacially for huge data tables.

What was the result? when i update an existing row or delete it the changes are not reflected in the syncronization. But, when i insert a new row the changes are reflected.

Someone has experience with this kind of things?

In my job sometime we need to alter tables adding new columns. And now we are in the need for syncronizing databases.

Hope be clear. Thanks in advance.


回答1:


in step #3, when you drop the scope, you effectively dropped the sync knowledge of what was synched. you might was well just deprovision and reprovision.

tracking tables simply stores what was changed, it doesnt store what was synched. that's in the scope table's knowledge columns.

since you dropped the scope sync knowledge, sync fx has no way to tell that tables from both databases contains similar data. it then tries to apply the existing rows from one database to the other and you are most likely running into conflicts.

try subscribing to ApplyChangesFailed event and you should see conflicts firing.

new inserts will work because these are previously non-existing rows.



来源:https://stackoverflow.com/questions/12285307/sync-framework-and-add-columns

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