Partilhar via


SelfValidationAttribute Class

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.

Marks a method as implementing self validation logic.

Namespace:  Microsoft.Practices.EnterpriseLibrary.Validation.Validators
Assembly:  Microsoft.Practices.EnterpriseLibrary.Validation (in Microsoft.Practices.EnterpriseLibrary.Validation.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple := True, Inherited := False)> _
PublicNotInheritableClassSelfValidationAttribute _
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
publicsealedclassSelfValidationAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Method, AllowMultiple = true, Inherited = false)]
publicref classSelfValidationAttributesealed : public Attribute
publicfinalclass SelfValidationAttribute extends Attribute

Remarks

The following conditions must be met for a method to be considered for self validation:

  1. The type for which the validation is being created must have the HasSelfValidationAttribute. -
  2. The method must have the SelfValidationAttribute with configured for the requested ruleset. -
  3. The method must be void and take a single parameter of type ValidationResults. -

Non-public methods can be used for self validation, although inherited non-public methods will not be used.

There is no configuration based way to specify self validation.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Practices.EnterpriseLibrary.Validation.Validators.SelfValidationAttribute

See Also

SelfValidationAttribute Members

Microsoft.Practices.EnterpriseLibrary.Validation.Validators Namespace

Microsoft.Practices.EnterpriseLibrary.Validation.Validators.SelfValidationValidator

Microsoft.Practices.EnterpriseLibrary.Validation.Validators.HasSelfValidationAttribute

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.