DataAnnotationsModelValidatorProvider Class

 

Implements the default validation provider for ASP.NET MVC.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Inheritance Hierarchy

System.Object
  System.Web.Mvc.ModelValidatorProvider
    System.Web.Mvc.AssociatedValidatorProvider
      System.Web.Mvc.DataAnnotationsModelValidatorProvider

Syntax

public class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider
public ref class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider
type DataAnnotationsModelValidatorProvider = 
    class
        inherit AssociatedValidatorProvider
    end
Public Class DataAnnotationsModelValidatorProvider
    Inherits AssociatedValidatorProvider

Constructors

Name Description
System_CAPS_pubmethod DataAnnotationsModelValidatorProvider()

Initializes a new instance of the DataAnnotationsModelValidatorProvider class.

Properties

Name Description
System_CAPS_pubpropertySystem_CAPS_static AddImplicitRequiredAttributeForValueTypes

Gets or sets a value that indicates whether non-nullable value types are required.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod GetTypeDescriptor(Type)

Gets a type descriptor for the specified type.(Inherited from AssociatedValidatorProvider.)

System_CAPS_pubmethod GetValidators(ModelMetadata, ControllerContext)

Gets the validators for the model using the metadata and controller context.(Inherited from AssociatedValidatorProvider.)

System_CAPS_protmethod GetValidators(ModelMetadata, ControllerContext, IEnumerable<Attribute>)

Gets a list of validators.(Overrides AssociatedValidatorProvider.GetValidators(ModelMetadata, ControllerContext, IEnumerable<Attribute>).)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_static RegisterAdapter(Type, Type)

Registers an adapter to provide client-side validation.

System_CAPS_pubmethodSystem_CAPS_static RegisterAdapterFactory(Type, DataAnnotationsModelValidationFactory)

Registers an adapter factory for the validation provider.

System_CAPS_pubmethodSystem_CAPS_static RegisterDefaultAdapter(Type)

Registers the default adapter.

System_CAPS_pubmethodSystem_CAPS_static RegisterDefaultAdapterFactory(DataAnnotationsModelValidationFactory)

Registers the default adapter factory.

System_CAPS_pubmethodSystem_CAPS_static RegisterDefaultValidatableObjectAdapter(Type)

Registers an adapter to provide default object validation.

System_CAPS_pubmethodSystem_CAPS_static RegisterDefaultValidatableObjectAdapterFactory(DataAnnotationsValidatableObjectAdapterFactory)

Registers an adapter factory for the default object validation provider.

System_CAPS_pubmethodSystem_CAPS_static RegisterValidatableObjectAdapter(Type, Type)

Registers an adapter to provide object validation.

System_CAPS_pubmethodSystem_CAPS_static RegisterValidatableObjectAdapterFactory(Type, DataAnnotationsValidatableObjectAdapterFactory)

Registers an adapter factory for the object validation provider.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

A validation provider provides validators for the data model. This class is an implementation of the AssociatedValidatorProvider class. It provides validators for attributes which derive from ValidationAttribute and it provides a validator for types which implement IValidatableObject. To support client side validation, register adapters through the static methods of this class, or create validation attributes that implement IClientValidatable. The logic to support IClientValidatable is implemented in the DataAnnotationsModelValidator class.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

System.Web.Mvc Namespace

Return to top