Export (0) Print
Expand All

Understanding Validation Results

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 ValidationResults type is a collection of ValidationResult objects. Each ValidationResult object contains a report that includes references to the Validator instance, the object that was validated and error messages.

The ValidationResults.FindAll method filters a ValidationResult object and eliminates results that don't match the tags provided by the user. This method returns a new ValidationResults object that contains the desired information and leaves the original object unchanged.

The ValidationResults.IsValid property returns true if the validation passed and returns false if the validation failed.

The following table lists the properties that are used by the ValidationResult class.

Table 1: ValidationResult Properties

Property

Description

IsValid

This property returns true if the validation passed and returns false if the validation failed.

Key

This is a name that describes the location of the validation result. It contains the name of the member that is associated with the validator. It is null if the validator is defined at the type level.

Object

This is the object that was validated.

Message

This is a message that describes the validation failure.

Tag

This is a value that is supplied by the user that describes the result, usually for the purposes of categorization or filtering. The tag can be supplied through the constructor but it is typically set either by using a property in the validation attributes or with configuration.

Target

This is the object to which the validation rule was applied.

Validator

This is the validator that performed the validation that failed.

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.
Show:
© 2015 Microsoft