Microsoft Sync Framework Simple Provider – Concurrency Conflict Handling

The destination provider is responsible to resolve conflicts. In order to resolve concurrency conflicts ConflictResolutionAction need to be set. This can be set by the sync framework automatically by specify ConflictResolutionPolicy value (ApplicationDefined, DestinationWins, SourceWins) to SimpleSyncProvider.Configuration. If you specify the value of ApplicationDefined then ConflictResolutionAction  need to be set within  event handler of ItemConflicting event.

1. ConflictResolutionAction.SkipChange

e.SetResolutionAction(ConflictResolutionAction.SkipChange);

Neither source nor destination data store is updated.

It will be reflected through SyncOperationStatistics.DownloadChangesFailed or SyncOperationStatistics.UploadChangesFailed.

It will be counted as SyncOperationStatistics.DownloadChangesTotal or SyncOperationStatistics.UploadChangesTotal; because LoadChangeData is called on source provider.

ItemConflicting event will be raised for the same record during the next sync session.

2. ConflictResolutionAction.SaveConflict

The same effect as ConflictResolutionAction.SkipChange but with LoadChangeData is call one more time on source data source after ItemConflicting event is raised.

3. ConflictResolutionAction.DestinationWins

Based on the SyncDirectionOrder setting; source data store may be updated.

It will be reflected through SyncOperationStatistics.DownloadChangesApplied or SyncOperationStatistics.UploadChangesApplied.

It will be counted as SyncOperationStatistics.DownloadChangesTotal or SyncOperationStatistics.UploadChangesTotal.

ItemConflicting event will NOT be raised for the same record during the next sync session.

4. ConflictResolutionAction.SourceWins

Based on the SyncDirectionOrder setting; destination data store may be updated.

It will be reflected through SyncOperationStatistics.DownloadChangesApplied or SyncOperationStatistics.UploadChangesApplied.

It will be counted as SyncOperationStatistics.DownloadChangesTotal or SyncOperationStatistics.UploadChangesTotal.

ItemConflicting event will NOT be raised for the same record during the next sync session.

5. ConflictResolutionAction.Merge

When set resolution action to ConflictResolutionAction.Merge, ISimpleSyncProviderConcurrencyConflictResolver Interface need to be implemented. Based on the type of concurrency conflict the following three method will be called. ResolveLocalDeleteRemoteUpdateConflictResolveLocalUpdateRemoteDeleteConflict and ResolveUpdateUpdateConflict. Otherwise if these method is not implemented, it is treated as ConflictResolutionAction.SaveConflict.

You have to perform Create, Update, Delete operation in these three methods as the results of the resolution. (Except if a delete is the result of the resolution in either ResolveLocalDeleteRemoteUpdateConflict or ResolveLocalUpdateRemoteDeleteConflict, in this case SyncOrchestrator will invoke DeleteItem on the other provider)