ApplyAction 枚举

指定在同步期间无法应用某行时用于处理该行的选项。

命名空间: Microsoft.Synchronization.Data
程序集: Microsoft.Synchronization.Data(在 microsoft.synchronization.data.dll 中)

语法

声明
Public Enumeration ApplyAction
用法
Dim instance As ApplyAction
public enum ApplyAction
public enum class ApplyAction
public enum ApplyAction
public enum ApplyAction

成员

  成员名称 说明
Continue 继续处理,并将该行添加到 SyncConflict 对象中定义的冲突列表中。这是默认行为。 
RetryApplyingRow 尝试再次应用该行。 
RetryNextSync 将该行作为异常存储,并在下次同步会话期间尝试应用该行。仅对对等同步有效。 
RetryWithForceWrite 使用同步适配器命令中包含的逻辑强制应用该行。 

备注

如果在同步期间无法应用某行,则会引发 ApplyChangeFailed 事件。ApplyChangeFailedEventArgs 对象提供有关导致失败的错误或冲突的信息。在事件处理程序中,可以指定同步提供程序是否应该重新尝试应用该行。客户端上的强制写入变更由客户端同步提供程序处理。服务器上的强制写入变更需要代码中具有将变更应用于服务器的逻辑。有关更多信息,请参见如何处理数据冲突和错误

示例

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