Class ActionWorkflowOperation
- Namespace
- WorkflowForge.Operations
- Assembly
- WorkflowForge.dll
A workflow operation that executes a simple action without returning a result. Useful for side-effects like logging, notifications, or state changes.
public sealed class ActionWorkflowOperation : WorkflowOperationBase, IWorkflowOperation, IDisposable
- Inheritance
-
ActionWorkflowOperation
- Implements
- Inherited Members
- Extension Methods
Constructors
ActionWorkflowOperation(string, Func<object?, IWorkflowFoundry, CancellationToken, Task>, Func<object?, IWorkflowFoundry, CancellationToken, Task>?)
Initializes a new instance of the ActionWorkflowOperation class.
public ActionWorkflowOperation(string name, Func<object?, IWorkflowFoundry, CancellationToken, Task> actionFunc, Func<object?, IWorkflowFoundry, CancellationToken, Task>? restoreFunc = null)
Parameters
namestringThe name of the action operation.
actionFuncFunc<object, IWorkflowFoundry, CancellationToken, Task>The action function to execute.
restoreFuncFunc<object, IWorkflowFoundry, CancellationToken, Task>Optional restoration function for compensation.
Properties
Name
Gets the name of this action operation.
public override string Name { get; }
Property Value
Methods
ForgeAsyncCore(object?, IWorkflowFoundry, CancellationToken)
Executes the action and returns the input data unchanged.
protected override Task<object?> ForgeAsyncCore(object? inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)
Parameters
inputDataobjectThe input data to pass through.
foundryIWorkflowFoundryThe workflow foundry providing context and services.
cancellationTokenCancellationTokenThe cancellation token.
Returns
RestoreAsync(object?, IWorkflowFoundry, CancellationToken)
Executes the restoration action if supported.
public override Task RestoreAsync(object? outputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)
Parameters
outputDataobjectThe output data for restoration.
foundryIWorkflowFoundryThe workflow foundry providing context and services.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the restoration operation.