Sdílet prostřednictvím


ConflictType Enumeration

Defines the types of conflicts that can occur during synchronization.

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

Syntax

'Declaration
Public Enumeration ConflictType
public enum ConflictType
public enum class ConflictType
public enum ConflictType
public enum ConflictType

Members

Member name Description
ClientDeleteServerUpdate The client deleted a row that the server updated.
ClientInsertServerInsert The client and server both inserted a row that has the same primary key value. This caused a primary key violation.
ClientUpdateServerDelete The server deleted a row that the client updated.
ClientUpdateServerUpdate The client and the server updated the same row.
ErrorsOccurred The client or server store (typically a database) threw an exception while applying a change.
Unknown The client synchronization provider can classify all conflicts that it encounters, but the server synchronization provider cannot. Therefore, some conflicts are classified as Unknown.

Remarks

A conflict occurs when the same row is inserted, updated, or deleted at more than one place between synchronizations. Conflicts are always defined as having occurred between the server and client that are currently synchronizing. However, that does not mean that the conflicting change at the server necessarily originated at the server. For more information, see How to: Handle Data Conflicts and Errors.

Example

The following code example specifies a value of RetryWithForceWrite for client-update/server-delete conflicts. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.

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

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