SyncConflictResolver クラス

同期中に競合が発生した場合に実行するアクションを表します。

名前空間: Microsoft.Synchronization.Data
アセンブリ: Microsoft.Synchronization.Data (microsoft.synchronization.data.dll 内)

構文

'宣言
<SerializableAttribute> _
Public Class SyncConflictResolver
'使用
Dim instance As SyncConflictResolver
[SerializableAttribute] 
public class SyncConflictResolver
[SerializableAttribute] 
public ref class SyncConflictResolver
/** @attribute SerializableAttribute() */ 
public class SyncConflictResolver
SerializableAttribute 
public class SyncConflictResolver

解説

SqlCeClientSyncProvider には、クライアントでの競合の解決に使用できる ConflictResolver プロパティが含まれています。競合の種類ごとに、ResolveAction 列挙体から値を設定できます。

競合の種類ごとに ConflictResolver を設定する必要はありません。ApplyChangeFailed イベントを処理することによって、サーバーの場合と同様に競合を解決できます。ただし、ConflictResolver プロパティを使用すると、クライアントで競合解決オプションを簡単に指定できます。詳細については、「データの競合とエラーを処理する方法」を参照してください。

次のコード例では、クライアント同期プロバイダーで発生する可能性のある競合の種類ごとに解決アクションを設定します。完全なコンテキスト例でこのコードを表示するには、「データの競合とエラーを処理する方法」を参照してください。

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

継承階層

System.Object
  Microsoft.Synchronization.Data.SyncConflictResolver

スレッド セーフ

この型の public static (Visual Basic では Shared ) メンバーはすべて、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

参照

リファレンス

SyncConflictResolver メンバー
Microsoft.Synchronization.Data 名前空間