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
foundryIWorkflowFoundryThe workflow foundry.
dataExtractorFunc<IWorkflowFoundry, T>Function to extract data from foundry properties for validation.
optionsValidationMiddlewareOptionsConfiguration options for validation behavior.
Returns
- IWorkflowFoundry
The foundry for method chaining.
Type Parameters
TThe 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
foundryIWorkflowFoundryThe workflow foundry.
validatorIWorkflowValidator<T>The workflow validator.
dataExtractorFunc<IWorkflowFoundry, T>Function to extract data from foundry properties for validation.
optionsValidationMiddlewareOptionsConfiguration options for validation behavior.
Returns
- IWorkflowFoundry
The foundry for method chaining.
Type Parameters
TThe 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
foundryIWorkflowFoundryThe workflow foundry.
validatorIWorkflowValidator<T>The workflow validator.
dataTThe data to validate.
propertyKeystringThe foundry property key to store the validation result.
Returns
- Task<ValidationResult>
A task representing the validation result.
Type Parameters
TThe 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
foundryIWorkflowFoundryThe workflow foundry.
dataTThe data to validate.
propertyKeystringThe foundry property key to store the validation result.
Returns
- Task<ValidationResult>
A task representing the validation result.
Type Parameters
TThe type of data to validate.