Show / Hide Table of Contents

Interface IValidator

An object which may be used to validate object instances and get a validation result.

Namespace: CSF.Validation
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IValidator

Properties

| Improve this Doc View Source

ValidatedType

Gets the type of object that this validator is intended to validate.

Declaration
Type ValidatedType { get; }
Property Value
Type Description
System.Type
Remarks

The first parameter to ValidateAsync(Object, ValidationOptions, CancellationToken) must be of either the type indicated by this property, or a type that is derived from the type indicated by this property.

Methods

| Improve this Doc View Source

ValidateAsync(Object, ValidationOptions, CancellationToken)

Validate the specified object instance asynchronously and get a validation result.

Declaration
Task<ValidationResult> ValidateAsync(object validatedObject, ValidationOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Object 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<ValidationResult>

A task containing the result of the validation process.

Exceptions
Type Condition
System.InvalidCastException

If the validatedObject is of an inappropriate type to be validated by the validator.

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX