Interface IValidator<TValidated>
An object which may be used to validate instances of a specified object type and get a validation result.
Namespace: CSF.Validation
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IValidator<TValidated>
Type Parameters
Name | Description |
---|---|
TValidated | The type of object which will be validated. |
Methods
| Improve this Doc View SourceValidateAsync(TValidated, ValidationOptions, CancellationToken)
Validate the specified object instance asynchronously and get a validation result.
Declaration
Task<IQueryableValidationResult<TValidated>> ValidateAsync(TValidated validatedObject, ValidationOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TValidated | validatedObject | The object to be validated. |
ValidationOptions | options | An optional object containing configuration options related to the validation process. |
System.Threading.CancellationToken | cancellationToken | An optional object which enables premature cancellation of the validation process. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IQueryableValidationResult<TValidated>> | A task containing the result of the validation process. |
Exceptions
Type | Condition |
---|---|
ValidationException | If the validation process fails or errors and the RuleThrowingBehaviour of the resolved options indicate that an exception should be thrown. See IGetsResolvedValidationOptions for more info about how the options are resolved from the defaults configured with DI and the options specified here. |