保存delta脚本 [英] save the delta script
问题描述
嘿伙计
我想让Sync Framework比较两个数据库和数据库的数据。递给我一个delta脚本来保存在磁盘上(很像Visual Studio中的Data Compare)。
I'd like to have Sync Framework compare data on 2 databases & hand me a delta script to save on disk (much like Data Compare in Visual Studio).
我很难找到检索脚本的方法。我查看了SyncAdapter,ChangeBatch,DbApplyingChangesEventArgs.Context.DataSet& Microsoft.SqlServer.Management.Smo.Table.Script()但答案似乎并不存在。
I'm having a hard time finding a way to retrieve the script. I looked at SyncAdapter, ChangeBatch, DbApplyingChangesEventArgs.Context.DataSet & Microsoft.SqlServer.Management.Smo.Table.Script() but the answer doesn't seem to be there.
任何人都可以对此有所了解吗?
Could anyone shed some light on this?
谢谢
Amir
推荐答案
遗憾的是,Sync Fx与数据比较的工作方式不同。同步Fx适用于"增量变更跟踪"。而不是差异(你在两个副本之间的不同之处。在同步Fx中,你会发现它只是同步行从最后一次同步改变了
。
unfortunately, Sync Fx doesn't work similar to Data Compare. Sync Fx works on "incremental change tracking" rather than differential (where you tract what is different between two replicas. In Sync Fx, you'll find that it's only synching rows that has change from the last synch.
如果您正在使用脱机提供程序,则应用更改的SQL语句位于SyncAdapter中,如果它是协作提供程序,则与范围关联的存储过程可在作用域定义中找到。
If you're using the offline providers, the SQL statements that apply the changes are in the SyncAdapter, if it's the collaboration providers, the stored procs associated with the scope are found in the scope definition.
您实际上可以找到在ChangesSelected事件中检测到的实际数据更改。事件参数将包含一个数据集,其中包含检测为更改的行。
You can actually find the actual data changes that were detected in the ChangesSelected event. The event argument will have a dataset that contains the rows that were detected as changes.
这篇关于保存delta脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!