次の方法で共有


ConflictType 列挙体

同期中に発生する可能性のある競合の種類を定義します。

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

構文

'宣言
Public Enumeration ConflictType
'使用
Dim instance As ConflictType
public enum ConflictType
public enum class ConflictType
type ConflictType
public enum ConflictType

メンバー

メンバー名 説明
Unknown クライアント同期プロバイダーは、発生したすべての競合を分類できますが、サーバー同期プロバイダーは分類できません。そのため、一部の競合は、Unknown として分類されます。
ErrorsOccurred 変更の適用中、クライアント ストアまたはサーバー ストア (通常はデータベース) から例外がスローされました。
ClientUpdateServerUpdate クライアントとサーバーで、同じ行が更新されました。
ClientUpdateServerDelete クライアントで更新された行がサーバーで削除されました。
ClientDeleteServerUpdate サーバーで更新された行がクライアントで削除されました。
ClientInsertServerInsert クライアントとサーバーの両方で、同じ主キー値を持つ行が挿入されました。これにより、主キー違反が発生しました。

説明

競合は、同期中に同じ行が複数の場所で挿入、更新、または削除されたときに発生します。競合は、常に、現在同期中のサーバーとクライアントとの間で発生しているものとして定義されます。ただし、サーバーで競合している変更は、必ずしもサーバーで発生したとは限りません。詳細については、「データの競合とエラーを処理する方法」を参照してください。

次のコード例では、クライアントでの更新とサーバーでの削除が競合した場合は、RetryWithForceWrite の値を指定します。完全なコンテキスト例でこのコードを表示するには、「データの競合とエラーを処理する方法」を参照してください。

if (e.Conflict.ConflictType == ConflictType.ClientUpdateServerDelete)
{

    //For client-update/server-delete conflicts, we force the client 
    //change to be applied at the server. The stored procedure specified for 
    //customerSyncAdapter.UpdateCommand accepts the @sync_force_write parameter
    //and includes logic to handle this case.
    Console.WriteLine(String.Empty);
    Console.WriteLine("***********************************");
    Console.WriteLine("A client update / server delete conflict was detected.");

    e.Action = ApplyAction.RetryWithForceWrite;

    Console.WriteLine("The client change was retried at the server with RetryWithForceWrite.");
    Console.WriteLine("***********************************"); 
    Console.WriteLine(String.Empty);

}
If e.Conflict.ConflictType = ConflictType.ClientUpdateServerDelete Then

    'For client-update/server-delete conflicts, we force the client 
    'change to be applied at the server. The stored procedure specified for 
    'customerSyncAdapter.UpdateCommand accepts the @sync_force_write parameter
    'and includes logic to handle this case.
    Console.WriteLine(String.Empty)
    Console.WriteLine("***********************************")
    Console.WriteLine("A client update / server delete conflict was detected.")

    e.Action = ApplyAction.RetryWithForceWrite

    Console.WriteLine("The client change was retried at the server with RetryWithForceWrite.")
    Console.WriteLine("***********************************")
    Console.WriteLine(String.Empty)
End If

参照

参照

Microsoft.Synchronization.Data 名前空間