Table of Contents

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

name string

The name of the action operation.

actionFunc Func<object, IWorkflowFoundry, CancellationToken, Task>

The action function to execute.

restoreFunc Func<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

string

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

inputData object

The input data to pass through.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<object>

The input data unchanged.

RestoreAsync(object?, IWorkflowFoundry, CancellationToken)

Executes the restoration action if supported.

public override Task RestoreAsync(object? outputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

outputData object

The output data for restoration.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task representing the restoration operation.