Interface IValidatorInvoker
- Namespace
- Cratis.Arc.Validation
- Assembly
- Cratis.Arc.Core.dll
Defines a system that runs a validator against an instance and expresses the outcome as framework ValidationResult instances.
public interface IValidatorInvoker
- Extension Methods
Remarks
This is the only place that knows the validation library's shape — how a validation context is built, how its severities map, and what happens when a validator throws. Keeping it apart from the traversal means the graph walk deals purely in "what should be validated", and swapping or extending the validation library touches one type.
Methods
Invoke(object, IValidator, string, CancellationToken)
Runs a validator against an instance.
Task<IEnumerable<ValidationResult>> Invoke(object instance, IValidator validator, string path, CancellationToken cancellationToken = default)
Parameters
instanceobjectThe instance to validate.
validatorIValidatorThe FluentValidation.IValidator to run.
pathstringThe camelCased member path from the graph root to
instance, empty at the root.cancellationTokenCancellationTokenOptional CancellationToken for cancelling the validation.
Returns
- Task<IEnumerable<ValidationResult>>
The ValidationResult collection describing the outcome, empty when valid.