Table of Contents

Class ValidationExtensions

Namespace
WorkflowForge.Extensions.Validation
Assembly
WorkflowForge.Extensions.Validation.dll

Extension methods for adding validation capabilities to WorkflowForge.

public static class ValidationExtensions
Inheritance
ValidationExtensions
Inherited Members

Methods

UseValidation<T>(IWorkflowFoundry, Func<IWorkflowFoundry, T?>, ValidationMiddlewareOptions?)

Adds a DataAnnotations validator to the foundry's middleware pipeline with options.

public static IWorkflowFoundry UseValidation<T>(this IWorkflowFoundry foundry, Func<IWorkflowFoundry, T?> dataExtractor, ValidationMiddlewareOptions? options = null) where T : class

Parameters

foundry IWorkflowFoundry

The workflow foundry.

dataExtractor Func<IWorkflowFoundry, T>

Function to extract data from foundry properties for validation.

options ValidationMiddlewareOptions

Configuration options for validation behavior.

Returns

IWorkflowFoundry

The foundry for method chaining.

Type Parameters

T

The type of data to validate.

Exceptions

ArgumentNullException

Thrown when required parameters are null.

UseValidation<T>(IWorkflowFoundry, IWorkflowValidator<T>, Func<IWorkflowFoundry, T?>, ValidationMiddlewareOptions?)

Adds a custom workflow validator to the foundry's middleware pipeline with options.

public static IWorkflowFoundry UseValidation<T>(this IWorkflowFoundry foundry, IWorkflowValidator<T> validator, Func<IWorkflowFoundry, T?> dataExtractor, ValidationMiddlewareOptions? options = null) where T : class

Parameters

foundry IWorkflowFoundry

The workflow foundry.

validator IWorkflowValidator<T>

The workflow validator.

dataExtractor Func<IWorkflowFoundry, T>

Function to extract data from foundry properties for validation.

options ValidationMiddlewareOptions

Configuration options for validation behavior.

Returns

IWorkflowFoundry

The foundry for method chaining.

Type Parameters

T

The type of data to validate.

Exceptions

ArgumentNullException

Thrown when required parameters are null.

ValidateAsync<T>(IWorkflowFoundry, IWorkflowValidator<T>, T, string)

Validates data using a custom workflow validator and stores the result in foundry properties.

public static Task<ValidationResult> ValidateAsync<T>(this IWorkflowFoundry foundry, IWorkflowValidator<T> validator, T data, string propertyKey = "ValidationResult")

Parameters

foundry IWorkflowFoundry

The workflow foundry.

validator IWorkflowValidator<T>

The workflow validator.

data T

The data to validate.

propertyKey string

The foundry property key to store the validation result.

Returns

Task<ValidationResult>

A task representing the validation result.

Type Parameters

T

The type of data to validate.

ValidateAsync<T>(IWorkflowFoundry, T, string)

Validates data using DataAnnotations and stores the result in foundry properties.

public static Task<ValidationResult> ValidateAsync<T>(this IWorkflowFoundry foundry, T data, string propertyKey = "ValidationResult")

Parameters

foundry IWorkflowFoundry

The workflow foundry.

data T

The data to validate.

propertyKey string

The foundry property key to store the validation result.

Returns

Task<ValidationResult>

A task representing the validation result.

Type Parameters

T

The type of data to validate.