Action 属性

获取或设置一个 ApplyAction 枚举值,该枚举值指定采取何种操作来处理相应冲突。

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

语法

声明
Public Property Action As ApplyAction
    Get
    Set
用法
Dim instance As ApplyChangeFailedEventArgs
Dim value As ApplyAction

value = instance.Action

instance.Action = value
public ApplyAction Action { get; set; }
public:
property ApplyAction Action {
    ApplyAction get ();
    void set (ApplyAction value);
}
member Action : ApplyAction with get, set
function get Action () : ApplyAction
function set Action (value : ApplyAction)

属性值

类型:Microsoft.Synchronization.Data. . :: . .ApplyAction
一个 ApplyAction 枚举值,指定采取何种操作来处理冲突。

注释

如果在同步期间无法应用某行,则会引发 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

请参阅

参考

ApplyChangeFailedEventArgs类

ApplyChangeFailedEventArgs 成员

Microsoft.Synchronization.Data 命名空间