Table of Contents

Class WorkflowOperationBase<TInput, TOutput>

Namespace
WorkflowForge.Operations
Assembly
WorkflowForge.dll

Base class for typed workflow operations providing automatic type conversion for the untyped interface. Includes lifecycle hooks for before/after execution without requiring middleware.

public abstract class WorkflowOperationBase<TInput, TOutput> : WorkflowOperationBase, IWorkflowOperation<TInput, TOutput>, IWorkflowOperation, IDisposable

Type Parameters

TInput

The type of input data this operation expects.

TOutput

The type of output data this operation produces.

Inheritance
WorkflowOperationBase<TInput, TOutput>
Implements
IWorkflowOperation<TInput, TOutput>
Derived
Inherited Members
Extension Methods

Methods

ForgeAsync(TInput, IWorkflowFoundry, CancellationToken)

Executes the typed operation with lifecycle hooks.

public Task<TOutput> ForgeAsync(TInput inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData TInput

The typed input data.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TOutput>

The typed output data.

ForgeAsyncCore(object?, IWorkflowFoundry, CancellationToken)

Implements the untyped interface by casting to/from the typed interface. DO NOT OVERRIDE THIS METHOD - it handles type conversion automatically.

protected override sealed Task<object?> ForgeAsyncCore(object? inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData object
foundry IWorkflowFoundry
cancellationToken CancellationToken

Returns

Task<object>

ForgeAsyncCore(TInput, IWorkflowFoundry, CancellationToken)

Strongly-typed core operation logic. This is the main method you should override in your custom operations.

protected abstract Task<TOutput> ForgeAsyncCore(TInput inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData TInput

The typed input data.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TOutput>

The typed output data.

OnAfterExecuteAsync(object?, object?, IWorkflowFoundry, CancellationToken)

Overrides base hooks to prevent double-calling when typed hooks are used.

protected override Task OnAfterExecuteAsync(object? inputData, object? outputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData object
outputData object
foundry IWorkflowFoundry
cancellationToken CancellationToken

Returns

Task

OnAfterExecuteAsync(TInput, TOutput, IWorkflowFoundry, CancellationToken)

Called after the operation executes successfully with typed data. Override to add cleanup/finalization logic.

protected virtual Task OnAfterExecuteAsync(TInput inputData, TOutput outputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData TInput

The typed input data that was passed to the operation.

outputData TOutput

The typed output data produced by the operation.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task representing the asynchronous operation.

OnBeforeExecuteAsync(object?, IWorkflowFoundry, CancellationToken)

Overrides base hooks to prevent double-calling when typed hooks are used.

protected override Task OnBeforeExecuteAsync(object? inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData object
foundry IWorkflowFoundry
cancellationToken CancellationToken

Returns

Task

OnBeforeExecuteAsync(TInput, IWorkflowFoundry, CancellationToken)

Called before the operation executes with typed input. Override to add setup/initialization logic.

protected virtual Task OnBeforeExecuteAsync(TInput inputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

inputData TInput

The typed input data for the operation.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task representing the asynchronous operation.

RestoreAsync(object?, IWorkflowFoundry, CancellationToken)

Implements the untyped restoration interface. DO NOT OVERRIDE THIS METHOD - it handles type conversion automatically.

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

Parameters

outputData object
foundry IWorkflowFoundry
cancellationToken CancellationToken

Returns

Task

RestoreAsync(TOutput, IWorkflowFoundry, CancellationToken)

Strongly-typed restoration logic. Override this method if your operation supports restoration/rollback.

public virtual Task RestoreAsync(TOutput outputData, IWorkflowFoundry foundry, CancellationToken cancellationToken = default)

Parameters

outputData TOutput

The typed output data to restore.

foundry IWorkflowFoundry

The workflow foundry providing context and services.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A task representing the restoration operation.