Sdílet prostřednictvím


ResolveAction Enumeration

Specifies the options for resolving any conflicts that occur at the client during synchronization.

Namespace: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (in microsoft.synchronization.data.dll)

Syntax

'Declaration
Public Enumeration ResolveAction
public enum ResolveAction
public enum class ResolveAction
public enum ResolveAction
public enum ResolveAction

Members

Member name Description
ClientWins Overwrite the row at the server with the row from the client.
FireEvent Raise the client ApplyChangeFailed event or the server ApplyChangeFailed event.
ServerWins Overwrite the row at the client with the row from the server.

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:

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.

Example

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

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements (Synchronization Services).

Target Platforms

See Also

Reference

Microsoft.Synchronization.Data Namespace