SyncConflictResolver Class

Represents the actions to take when any conflicts occur during synchronization.

Inheritance Hierarchy

System.Object
  Microsoft.Synchronization.Data.SyncConflictResolver

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class SyncConflictResolver
'Usage
Dim instance As SyncConflictResolver
[SerializableAttribute]
public class SyncConflictResolver
[SerializableAttribute]
public ref class SyncConflictResolver
[<SerializableAttribute>]
type SyncConflictResolver =  class end
public class SyncConflictResolver

The SyncConflictResolver type exposes the following members.

Constructors

  Name Description
Public method SyncConflictResolver Initializes a new instance of the SyncConflictResolver class.

Top

Properties

  Name Description
Public property ClientDeleteServerUpdateAction Gets or sets a ResolveAction enumeration value that specifies the action to take when a ClientDeleteServerUpdate conflict occurs.
Public property ClientInsertServerInsertAction Gets or sets a ResolveAction enumeration value that specifies the action to take when a ClientInsertServerInsert conflict occurs.
Public property ClientUpdateServerDeleteAction Gets or sets a ResolveAction enumeration value that specifies the action to take when a ClientUpdateServerDelete conflict occurs.
Public property ClientUpdateServerUpdateAction Gets or sets a ResolveAction enumeration value that specifies the action to take when a ClientUpdateServerUpdate conflict occurs.
Public property StoreErrorAction Gets or sets a ResolveAction enumeration value that specifies the action to take when an error occurs in the client or server data store.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

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.

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Synchronization.Data Namespace