Compartilhar via


ApplyChangeFailedEventArgs.Action Property

Gets or sets an ApplyAction enumeration value that specifies the action to handle the conflict.

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

Syntax

'Declaration
Public Property Action As ApplyAction
public ApplyAction Action { get; set; }
public:
property ApplyAction Action {
    ApplyAction get ();
    void set (ApplyAction value);
}
/** @property */
public ApplyAction get_Action ()

/** @property */
public void set_Action (ApplyAction value)
public function get Action () : ApplyAction

public function set Action (value : ApplyAction)

Property Value

An ApplyAction enumeration value that specifies the action to handle the conflict.

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 specify whether the synchronization provider should try to apply the row again. Force writing changes on the client is handled by the client synchronization provider. Force writing changes on the server requires logic in the code that applies changes to the server. For more information, see How to: Handle Data Conflicts and Errors.

Example

The following code example specifies a value of RetryWithForceWrite for client-update/server-delete conflicts. To view this code in the context of a complete example, see How to: Handle Data Conflicts and Errors.

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

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.

Platforms

Development Platforms

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

Target Platforms

See Also

Reference

ApplyChangeFailedEventArgs Class
ApplyChangeFailedEventArgs Members
Microsoft.Synchronization.Data Namespace