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
public enum ConflictType
public enum ConflictType

成员

  成员名称 说明
ClientDeleteServerUpdate 客户端删除了服务器更新的行。 
ClientInsertServerInsert 客户端和服务器都插入了具有相同主键值的行。此操作导致了主键冲突。 
ClientUpdateServerDelete 服务器删除了客户端更新的行。 
ClientUpdateServerUpdate 客户端和服务器更新了相同的行。 
ErrorsOccurred 客户端或服务器存储区(通常为数据库)在应用变更时引发了一个异常。 
Unknown 客户端同步提供程序能对所遇到的所有冲突进行分类,但服务器同步提供程序不能。因此,一些冲突可归类为 Unknown。 

备注

在同步之间,当在多个位置上插入、更新或删除相同的行时会发生冲突。冲突始终定义为在当前正在同步的服务器和客户端之间发生。不过,这并不意味着服务器上相冲突的变更一定是在服务器上产生的。有关更多信息,请参见如何处理数据冲突和错误

示例

下面的代码示例针对客户端更新/服务器删除冲突指定 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 命名空间