Share via


ValidatorAttribute 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.

The latest Enterprise Library information can be found at the Enterprise Library site.

Describes the validation logic that must be applied to a language element when creating a Validator for a type.

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

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Parameter, AllowMultiple := True,  _
    Inherited := False)> _
Public MustInherit Class ValidatorAttribute _
    Inherits BaseValidationAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = true, 
    Inherited = false)]
public abstract class ValidatorAttribute : BaseValidationAttribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Parameter, AllowMultiple = true, 
    Inherited = false)]
public ref class ValidatorAttribute abstract : public BaseValidationAttribute
public abstract class ValidatorAttribute extends BaseValidationAttribute

Remarks

Multiple validator attributes can be specified for a language element.

All the rules will be applied as an "And" composition unless the ValidatorCompositionAttribute overrides this behavior.

A ruleset can be specified for the attribute, as well as message overrides (either literal or resource based).

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Practices.EnterpriseLibrary.Validation.Validators.BaseValidationAttribute
      Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValidatorAttribute
        Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ObjectCollectionValidatorAttribute
        Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ObjectValidatorAttribute
        Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValueValidatorAttribute

See Also

ValidatorAttribute Members

Microsoft.Practices.EnterpriseLibrary.Validation.Validators Namespace

Microsoft.Practices.EnterpriseLibrary.Validation.Validation

Microsoft.Practices.EnterpriseLibrary.Validation.ValidationFactory

Microsoft.Practices.EnterpriseLibrary.Validation.Validator

Microsoft.Practices.EnterpriseLibrary.Validation.Validators.ValidatorCompositionAttribute

Microsoft.Practices.EnterpriseLibrary.Validation.Validators.IgnoreNullsAttribute