Sync Framework Conflict resolution RRS feed

  • Question


    I am developing N-Tier sync application using the following code example (http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208) and working on conflict resolution.

    To resolve the conflict I am using syncProvider.ApplyChangeFailed event For both local sync provider and remote sync provider.

    syncProvider.ApplyChangeFailed event is not fire on local sync provider. Interesting thing is this even fire on remote proxy provider.

    Also I have tried with

    localProvider.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.RenameDestination ;
               localProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined   ;
             remoteProvider.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.RenameSource ;
             remoteProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.DestinationWins  ; 

    But so far no luck.

    I am greatly appreciate someone can guide me on this issue.

    Friday, January 4, 2013 4:10 AM

All replies

  • the ApplyChangeFailed Event on the local provider fires when there's a conflict applying on the local provider

    the ApplyChangeFailed Event on the remote provider is fired when there's a conflict on the remote provider.

    meaning, they will be fired separately. a conflict on the remote side will not cause the local providers ApplyChangeFailed event to fire and vice versa.

    the SqlSyncProvider will not allow you to set the conflict resolution policy via the Configuration property. if you look at the documentation, it clearly states that the Configuration property is not implemented by the RelationalSyncProvider from which the SqlSyncProvider inherits from.

    To set the conflict resolution, you have to do it inside the ApplyChangeFailed event. for every conflict, you can set the Action property to the corresponding conflict resolution that you want.

    see: How to: Handle Data Conflicts and Errors for Database Synchronization (SQL Server)

    Friday, January 4, 2013 4:12 AM