Compartilhar via


DbServerSyncProvider.ApplyChangeFailed Event

Occurs after a row fails to be applied at the server.

Namespace: Microsoft.Synchronization.Data.Server
Assembly: Microsoft.Synchronization.Data.Server (in microsoft.synchronization.data.server.dll)

Syntax

'Declaration
Public Event ApplyChangeFailed As EventHandler(Of ApplyChangeFailedEventArgs)
public event EventHandler<ApplyChangeFailedEventArgs> ApplyChangeFailed
public:
event EventHandler<ApplyChangeFailedEventArgs^>^ ApplyChangeFailed {
    void add (EventHandler<ApplyChangeFailedEventArgs^>^ value);
    void remove (EventHandler<ApplyChangeFailedEventArgs^>^ value);
}
/** @event */
public void add_ApplyChangeFailed (EventHandler<ApplyChangeFailedEventArgs> value)

/** @event */
public void remove_ApplyChangeFailed (EventHandler<ApplyChangeFailedEventArgs> value)
JScript supports the use of events, but not the declaration of new ones.

Example

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)

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.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements (Synchronization Services).

Target Platforms

See Also

Reference

DbServerSyncProvider Class
DbServerSyncProvider Members
Microsoft.Synchronization.Data.Server Namespace