Compartilhar via


DataAnnotationsModelValidatorProvider Class

Implements the default validation provider for MVC.

Inheritance Hierarchy

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

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

Syntax

'Declaration
Public Class DataAnnotationsModelValidatorProvider _
    Inherits AssociatedValidatorProvider
public class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider
public ref class DataAnnotationsModelValidatorProvider : public AssociatedValidatorProvider

The DataAnnotationsModelValidatorProvider type exposes the following members.

Constructors

  Name Description
Public method DataAnnotationsModelValidatorProvider Initializes a new instance of the DataAnnotationsModelValidatorProvider class.

Top

Properties

  Name Description
Public propertyStatic member AddImplicitRequiredAttributeForValueTypes Gets or sets a value that indicates whether non-nullable value types are required.

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method GetTypeDescriptor Gets a type descriptor for the specified type. (Inherited from AssociatedValidatorProvider.)
Public method GetValidators(ModelMetadata, ControllerContext) Gets the validators for the model using the metadata and controller context. (Inherited from AssociatedValidatorProvider.)
Protected method GetValidators(ModelMetadata, ControllerContext, IEnumerable<Attribute>) Gets a list of validators. (Overrides AssociatedValidatorProvider.GetValidators(ModelMetadata, ControllerContext, IEnumerable<Attribute>).)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic member RegisterAdapter Registers an adapter to provide client-side validation.
Public methodStatic member RegisterAdapterFactory Registers an adapter factory for the validation provider.
Public methodStatic member RegisterDefaultAdapter Registers the default adapter.
Public methodStatic member RegisterDefaultAdapterFactory Registers the default adapter factory.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

A validation provider provides validators for the data model.

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

Reference

System.Web.Mvc Namespace