The Validation Application Block provides several validation classes, which inherit from the abstract Validator
class and these are called Validators. Each Validator
class is associated with a specific data type; the Validator
validates whether the input is valid or not. Validators can be associated with data types in several ways; association can be made through configuration, attributes, a combination of configuration, and attributes, and using self-validation. They can also be instantiated within our code without associating them with a data type. The concrete implementation of the Validator
class holds the validation logic; the block also provides Validator<T>
, which is a generic abstract class to validate the type represented by T
. The Validation Application Block provides the following Validators.
Value Validators as the name suggests perform validations on the value of their respective data type. These are implemented using the abstract class ValueValidator<T>.
Validator Class |
Description |
---|---|
|
The |
|
The |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object Validators performs validations on an object reference. Object Validator and Object Collection Validator fall under this category.
Validator Class |
Description |
---|---|
|
|
|
|
Instead of validating the entire data type using the defined Validators, Single Member Validators gives us the flexibility to validate the individual members of types. The Validation Application Block provides three different Validators: FieldValueValidator, MethodReturnValueValidator
, and PropertyValueValidator
.
Validator Class |
Description |
---|---|
|
|
|
|
|
|
Composite Validators provide the flexibility to combine multiple Validators. This category consists of "And" and "Or" Composite Validators.
Validator Class |
Description |
---|---|
|
The |
|
Similar to |
The following diagram lists the available Validator
classes and the inheritance hierarchy:
18.223.237.131