Table of Contents

Class WorkflowForge

Namespace
WorkflowForge
Assembly
WorkflowForge.dll

Main entry point for WorkflowForge - the enterprise workflow orchestration framework. Provides essential factory methods for creating workflow builders and smiths.

In the WorkflowForge metaphor:

  • The Forge is the main factory where workflows are created and configured
  • Foundries are execution environments created by smiths
  • Builders are the tools for constructing workflows
  • Smiths are the skilled craftsmen who manage foundries and forge workflows
public static class WorkflowForge
Inheritance
WorkflowForge
Inherited Members

Remarks

WorkflowForge follows enterprise-grade patterns:

  • Dependency-free core library
  • Modular extension architecture
  • Thread-safe operations
  • Comprehensive error handling
  • Performance monitoring capabilities

Methods

CreateFoundry(string, IWorkflowForgeLogger?, IDictionary<string, object?>?, WorkflowForgeOptions?)

Creates a foundry for workflow execution.

public static IWorkflowFoundry CreateFoundry(string workflowName, IWorkflowForgeLogger? logger = null, IDictionary<string, object?>? initialProperties = null, WorkflowForgeOptions? options = null)

Parameters

workflowName string

The name of the workflow.

logger IWorkflowForgeLogger

Optional logger for the foundry. If null, a null logger will be used.

initialProperties IDictionary<string, object>

Optional initial properties for the foundry. If null, an empty dictionary will be created.

options WorkflowForgeOptions

Optional execution options for the foundry.

Returns

IWorkflowFoundry

A new foundry instance.

Examples

// Simple foundry
var foundry1 = WorkflowForge.CreateFoundry("MyWorkflow");

// With logger
var foundry2 = WorkflowForge.CreateFoundry("MyWorkflow", logger);

// With initial properties
var properties = new Dictionary<string, object?> { ["UserId"] = "123" };
var foundry3 = WorkflowForge.CreateFoundry("MyWorkflow", null, properties);

// With both
var foundry4 = WorkflowForge.CreateFoundry("MyWorkflow", logger, properties);

Exceptions

ArgumentException

Thrown when workflowName is null, empty, or whitespace.

CreateSmith(IWorkflowForgeLogger?, IServiceProvider?, WorkflowForgeOptions?)

Creates a new workflow smith for executing workflows. The smith provides foundry management and workflow execution capabilities.

public static IWorkflowSmith CreateSmith(IWorkflowForgeLogger? logger = null, IServiceProvider? serviceProvider = null, WorkflowForgeOptions? options = null)

Parameters

logger IWorkflowForgeLogger

Optional logger for the smith. If null, a null logger will be used.

serviceProvider IServiceProvider

Optional service provider for dependency injection.

options WorkflowForgeOptions

Optional WorkflowForge configuration options.

Returns

IWorkflowSmith

A new workflow smith instance ready for workflow execution.

Examples

// Simple smith
var smith1 = WorkflowForge.CreateSmith();

// With logger
var smith2 = WorkflowForge.CreateSmith(logger);

// With service provider
var smith3 = WorkflowForge.CreateSmith(null, serviceProvider);

// With options
var options = new WorkflowForgeOptions { MaxConcurrentWorkflows = 10 };
var smith4 = WorkflowForge.CreateSmith(null, null, options);

// With all parameters
var smith5 = WorkflowForge.CreateSmith(logger, serviceProvider, options);

Exceptions

InvalidOperationException

Thrown when the smith cannot be created due to system constraints.

CreateWorkflow(string?, IServiceProvider?)

Creates a new workflow builder for defining and constructing workflows.

public static WorkflowBuilder CreateWorkflow(string? workflowName = null, IServiceProvider? serviceProvider = null)

Parameters

workflowName string

Optional name for the workflow. If not provided, a name can be set later using WithName().

serviceProvider IServiceProvider

Optional service provider for dependency injection. Can be null for standalone usage.

Returns

WorkflowBuilder

A new workflow builder instance ready for configuration.

Examples

// Without name (set later)
var builder = WorkflowForge.CreateWorkflow();
var workflow = builder
    .WithName("ProcessOrder")
    .AddOperation("ValidateOrder", async (f, ct) => ValidateOrder())
    .Build();

// With name
var builder2 = WorkflowForge.CreateWorkflow("ProcessPayment");

Exceptions

ArgumentException

Thrown when workflowName is provided but is empty or whitespace.

InvalidOperationException

Thrown when the builder cannot be created due to system constraints.