Share via


ApplyChangeFailedEventArgs 类

为客户端 ApplyChangeFailed 事件和服务器 ApplyChangeFailed 事件提供数据。

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

语法

声明
Public Class ApplyChangeFailedEventArgs _
    Inherits EventArgs
用法
Dim instance As ApplyChangeFailedEventArgs
public class ApplyChangeFailedEventArgs : EventArgs
public ref class ApplyChangeFailedEventArgs : public EventArgs
type ApplyChangeFailedEventArgs =  
    class
        inherit EventArgs
    end
public class ApplyChangeFailedEventArgs extends EventArgs

注释

如果在同步期间无法应用某行,则会引发 ApplyChangeFailed 事件。ApplyChangeFailedEventArgs 对象提供有关导致失败的错误或冲突的信息。在事件处理程序中,可以用多种方式来响应事件,包括指定同步提供程序是否应该重新尝试应用该行。有关更多信息,请参见如何处理事件和对业务逻辑进行编程如何处理数据冲突和错误

示例

下面的代码示例为 ApplyChangeFailed 事件指定事件处理程序。调用的方法可针对客户端和服务器同步提供程序将信息记录到单独的文件中。若要在完整示例上下文中查看此代码,请参见如何使用会话变量

this.ApplyChangeFailed += new EventHandler<ApplyChangeFailedEventArgs>(EventLogger.LogEvents);
else if (e is ApplyChangeFailedEventArgs)
{

    ApplyChangeFailedEventArgs args = (ApplyChangeFailedEventArgs)e;
    outputText.AppendLine("** APPLY CHANGE FAILURE AT " + site.ToUpper() + " **");
    outputText.AppendLine("Table for which failure occurred: " + args.TableMetadata.TableName);
    outputText.AppendLine("Error message: " + args.Error.Message);

}
AddHandler Me.ApplyChangeFailed, AddressOf EventLogger.LogEvents
ElseIf TypeOf e Is ApplyChangeFailedEventArgs Then

    Dim args As ApplyChangeFailedEventArgs = CType(e, ApplyChangeFailedEventArgs)
    outputText.AppendLine("** APPLY CHANGE FAILURE AT " & site.ToUpper() & " **")
    outputText.AppendLine("Table for which failure occurred: " & args.TableMetadata.TableName)
    outputText.AppendLine("Error message: " & args.Error.Message)

继承层次结构

System. . :: . .Object
  System. . :: . .EventArgs
    Microsoft.Synchronization.Data..::..ApplyChangeFailedEventArgs

线程安全

此类型的所有公共成员static(在 Visual Basic 中为 Shared) 都是线程安全的。不保证所有实例成员都是线程安全的。

请参阅

参考

ApplyChangeFailedEventArgs 成员

Microsoft.Synchronization.Data 命名空间