AssociatedValidatorProvider Class

 

Provides an abstract class for classes that implement a validation provider.

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 abstract class AssociatedValidatorProvider : ModelValidatorProvider
public ref class AssociatedValidatorProvider abstract : ModelValidatorProvider
[<AbstractClass>]
type AssociatedValidatorProvider = 
    class
        inherit ModelValidatorProvider
    end
Public MustInherit Class AssociatedValidatorProvider
    Inherits ModelValidatorProvider

Constructors

Name Description
System_CAPS_protmethod AssociatedValidatorProvider()

Called from constructors in derived classes to initialize the AssociatedMetadataProvider class.

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.

System_CAPS_pubmethod GetValidators(ModelMetadata, ControllerContext)

Gets the validators for the model using the metadata and controller context.(Overrides ModelValidatorProvider.GetValidators(ModelMetadata, ControllerContext).)

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

Gets the validators for the model using the metadata, the controller context, and a list of attributes.

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

A validation provider provides validation logic for the data model. A validation provider must derive from ModelValidatorProvider. You can inherit from this class if you want to use a custom validator provider or a third-party validator that uses attribute-based metadata. This class performs most of the work that is required in order to implement the ModelValidatorProvider class.

When you implement this class, use the AssociatedMetadataProvider class to implement the metadata provider.

Model provider classes and validator provider classes are loosely coupled. Therefore, they work independently, and have no dependencies on each other.

However, the metadata provider exposes metadata that can be accessed and used by validation providers. For example, the MVC default metadata provider (the DataAnnotationsModelMetadataProvider class) reads the display name of an object, and the display name is used by the DataAnnotationsModelValidatorProvider validation provider when it creates a validation error message.

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