Using the Provided Validators
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Enterprise Library information can be found at the Enterprise Library site. |
The Validation Application Block includes classes named validators, which derive from the Validator class. There is a generic version of this class named Validator<T>.
Every validator is associated with a specific type. For example, the StringLengthValidator class checks to see if a System.String value has a length within a predefined range.
There are three ways that you can associate validators with your types:
- You can use configuration. For more information, see Entering Configuration Information.
- You can use attributes. For more information, see Using Attributes to Define Validation Rule Sets. For the details of using attributes, see Details of Using Attributes.
- You can use a combination of configuration and attributes.
- You can use self validation, which means that you include validation logic within the object you want to validate. For more information, see Using Self Validation.
You can also instantiate validators within your code without associating them with a specific type. For more information, see Details of Creating Validators Programmatically.
The following sections describe the validator types that are included with the Validation Application Block. These validators are:
- And Composite Validator
- Contains Characters Validator
- Date Time Range Validator
- Domain Validator<T>
- Enum Conversion Validator
- Not Null Validator
- Object Collection Validator
- Object Validator
- Or Composite Validator
- Property Comparison Validator
- Range Validator<T>
- Regular Expression Validator
- Relative Date Time Validator
- String Length Validator
- Type Conversion Validator
Each entry contains examples for how to use the validator with attributes and with code. For an example of how to use configuration, see the Validation QuickStart.
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Enterprise Library information can be found at the Enterprise Library site. |