Share via


ApplyChangeFailedEventArgs Class

Provides data for the client ApplyChangeFailed event and the server ApplyChangeFailed event.

Inheritance Hierarchy

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

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
Public Class ApplyChangeFailedEventArgs _
    Inherits EventArgs
'Usage
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

The ApplyChangeFailedEventArgs type exposes the following members.

Constructors

  Name Description
Public method ApplyChangeFailedEventArgs Initializes a new instance of the ApplyChangeFailedEventArgs class by using table metadata, conflict, error, session, context, connection, and transaction parameters.

Top

Properties

  Name Description
Public property Action Gets or sets an ApplyAction enumeration value that specifies the action to handle the conflict.
Public property Conflict Gets a SyncConflict object that contains data and metadata for the row being applied and for the existing row in the data store that caused the failure.
Public property Connection Gets an IDbConnection object for the connection over which changes were attempted during synchronization.
Public property Context Gets a SyncContext object that contains data changes, and anchor values and other metadata for a synchronization session.
Public property Error Gets an Exception object that contains metadata about any exceptions that occurred during synchronization.
Public property Session Gets a SyncSession object that contains synchronization session variables, such as the ID of the client that is synchronizing.
Public property TableMetadata Gets a SyncTableMetaData object that contains metadata about the table, such as anchor values and the direction of synchronization.
Public property Transaction Gets or sets an IDbTransaction object that contains the transaction within which changes to tables were attempted.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Remarks

If a row cannot be applied during synchronization, the ApplyChangeFailed event is raised. The ApplyChangeFailedEventArgs object provides information about the error or conflict that caused the failure. In a handler for the event, you can respond to the event in several ways, including specifying whether the synchronization provider should try to apply the row again. For more information, see How to: Work with Events and Program Business Logic and How to: Handle Data Conflicts and Errors.

Examples

The following code examples specify an event handler for the ApplyChangeFailed event. The method called logs information to separate files for the client and server synchronization providers. To view this code in the context of a complete example, see How to: Use Session Variables.

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)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Synchronization.Data Namespace