Class DoWithCleanup
- Namespace
- Acuit.Pinpoint.Workflows.Activities
- Assembly
- Acuit.Pinpoint.Workflows.dll
Executes an activity and then performs cleanup.
public class DoWithCleanup : Activity, IActivity
- Inheritance
-
DoWithCleanup
- Implements
- Inherited Members
Remarks
The cleanup will always occur, even if Body fails or is canceled. The built-in TryCatch activity will not execute its Finally activity when it is canceled. This DoWithCleanup activity overcomes this limitation to perform cleanup that must always be performed, such as turning off power to the unit being tested.
When Cleanup is executed, it will never be canceled (i.e., it will always receive a None cancellation token).
If an exception is thrown while Cleanup is executing, then that exception will be the exception thrown out of this DoWithCleanup activity, regardless of whether a previous exception caused Cleanup to execute.
Properties
Body
public IActivity Body { get; set; }
Property Value
Cleanup
public IActivity Cleanup { get; set; }
Property Value
Methods
OnExecuteAsync(ActivityContext, CancellationToken)
Derived classes must implement this to perform the activity.
protected override Task OnExecuteAsync(ActivityContext context, CancellationToken cancellationToken)
Parameters
context
ActivityContextThe activity context.
cancellationToken
CancellationTokenThe cancellation token used to request canceling the activity.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- ArgumentNullException
context
is null.- InvalidOperationException
A service required by the activity is not available, or a required activity property value is not set.
- Exception
An error occurred while performing the activity.