Compensate Activity Designer

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Compensate activity designer is used to create and configure a Compensate activity.

The Compensate Activity

The Compensate activity explicitly invokes the CompensationHandler for an activity contained in a CompensableActivity. If the Compensate activity is not used within the CancellationHandler, CompensationHandler, or ConfirmationHandler of a CompensableActivity, then you must specify the Target property.

The CompensationToken specified by the Target provides a means to explicitly confirm or compensate a CompensableActivity once the Body of the CompensableActivity has successfully completed.

Using the Compensate Activity Designer

The Compensate activity designer can be found in the Transaction category of the Toolbox. To open Toolbox, select the Toolbox tab on the left side of the Workflow Designer. Alternatively, select Toolbox from the View menu, or press Ctrl+Alt+X.

The Compensate activity designer can be dragged from the Toolbox and dropped on to the Workflow Designer surface wherever activities are placed, such as inside a Sequence. Dropping the activity designer creates a Compensate activity with a default DisplayName of Compensate. The DisplayName value can be edited in the header of the Compensate activity designer or in the DisplayName box of the property grid.

The Compensate Properties

The following table shows the CancellationScope properties and describes how they are used in the designer. The DisplayName property can be edited in property grid or on Workflow Designer surface. Edit the Target property in the property grid.

Property Name Required Usage
DisplayName False Specifies the optional friendly name of the Compensate activity. The default is Compensate.
Target True Specifies the InArgument<T> that contains the CompensationToken for this Compensate activity.

See also