SqlCeClientSyncProvider.ConflictResolver Property
Gets a SyncConflictResolver object for the client synchronization provider, which determines what action to take when a conflict occurs.
Namespace: Microsoft.Synchronization.Data.SqlServerCe
Assembly: Microsoft.Synchronization.Data.SqlServerCe (in Microsoft.Synchronization.Data.SqlServerCe.dll)
Syntax
'Declaration
Public ReadOnly Property ConflictResolver As SyncConflictResolver
Get
'Usage
Dim instance As SqlCeClientSyncProvider
Dim value As SyncConflictResolver
value = instance.ConflictResolver
public SyncConflictResolver ConflictResolver { get; }
public:
property SyncConflictResolver^ ConflictResolver {
SyncConflictResolver^ get ();
}
member ConflictResolver : SyncConflictResolver
function get ConflictResolver () : SyncConflictResolver
Property Value
Type: Microsoft.Synchronization.Data.SyncConflictResolver
A SyncConflictResolver object that determines what action to take when a conflict occurs.
Remarks
The SqlCeClientSyncProvider includes a ConflictResolver property that you can use to resolve conflicts on the client. For each type of conflict, you can set a value from the ResolveAction enumeration:
ClientWins: equivalent to setting an ApplyAction of Continue.
ServerWins: equivalent to setting an ApplyAction of RetryWithForceWrite.
FireEvent: fire the ApplyChangeFailed event, the default, and then handle the event.
There is no requirement to set the ConflictResolver for each type of conflict. You can resolve conflicts as you do on the server, by handling the ApplyChangeFailed event. However, the ConflictResolver property does provide an easy way to specify conflict resolution options on the client. For more information, see How to: Handle Data Conflicts and Errors.
Examples
The following code example sets the resolution action for each type of conflict that the client synchronization provider can encounter. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.
this.ConflictResolver.ClientDeleteServerUpdateAction = ResolveAction.ServerWins;
this.ConflictResolver.ClientUpdateServerDeleteAction = ResolveAction.ClientWins;
//If any of the following conflicts or errors occur, the ApplyChangeFailed
//event is raised.
this.ConflictResolver.ClientInsertServerInsertAction = ResolveAction.FireEvent;
this.ConflictResolver.ClientUpdateServerUpdateAction = ResolveAction.FireEvent;
this.ConflictResolver.StoreErrorAction = ResolveAction.FireEvent;
//Log information for the ApplyChangeFailed event and handle any
//ResolveAction.FireEvent cases.
this.ApplyChangeFailed +=new EventHandler<ApplyChangeFailedEventArgs>(SampleClientSyncProvider_ApplyChangeFailed);
Me.ConflictResolver.ClientDeleteServerUpdateAction = ResolveAction.ServerWins
Me.ConflictResolver.ClientUpdateServerDeleteAction = ResolveAction.ClientWins
'If any of the following conflicts or errors occur, the ApplyChangeFailed
'event is raised.
Me.ConflictResolver.ClientInsertServerInsertAction = ResolveAction.FireEvent
Me.ConflictResolver.ClientUpdateServerUpdateAction = ResolveAction.FireEvent
Me.ConflictResolver.StoreErrorAction = ResolveAction.FireEvent
'Log information for the ApplyChangeFailed event and handle any
'ResolveAction.FireEvent cases.
AddHandler Me.ApplyChangeFailed, AddressOf SampleClientSyncProvider_ApplyChangeFailed