DataAnnotationsModelMetadataProvider Class

Implements the default model metadata provider for ASP.NET MVC.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.ModelMetadataProvider
    System.Web.Mvc.AssociatedMetadataProvider
      System.Web.Mvc.DataAnnotationsModelMetadataProvider

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

Syntax

'Declaration
Public Class DataAnnotationsModelMetadataProvider _
    Inherits AssociatedMetadataProvider
'Usage
Dim instance As DataAnnotationsModelMetadataProvider
public class DataAnnotationsModelMetadataProvider : AssociatedMetadataProvider
public ref class DataAnnotationsModelMetadataProvider : public AssociatedMetadataProvider
type DataAnnotationsModelMetadataProvider =  
    class 
        inherit AssociatedMetadataProvider 
    end
public class DataAnnotationsModelMetadataProvider extends AssociatedMetadataProvider

The DataAnnotationsModelMetadataProvider type exposes the following members.

Constructors

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

Top

Methods

  Name Description
Protected method CreateMetadata Gets the metadata for the specified property. (Overrides AssociatedMetadataProvider.CreateMetadata(IEnumerable<Attribute>, Type, Func<Object>, Type, String).)
Public method Equals (Inherited from Object.)
Protected method FilterAttributes Gets a list of attributes. (Inherited from AssociatedMetadataProvider.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetMetadataForProperties Returns a list of properties for the model. (Inherited from AssociatedMetadataProvider.)
Protected method GetMetadataForProperty(Func<Object>, Type, PropertyDescriptor) Returns the metadata for the specified property using the container type and property descriptor. (Inherited from AssociatedMetadataProvider.)
Public method GetMetadataForProperty(Func<Object>, Type, String) Returns the metadata for the specified property using the container type and property name. (Inherited from AssociatedMetadataProvider.)
Public method GetMetadataForType Returns the metadata for the specified property using the type of the model. (Inherited from AssociatedMetadataProvider.)
Public method GetType (Inherited from Object.)
Protected method GetTypeDescriptor Returns the type descriptor from the specified type. (Inherited from AssociatedMetadataProvider.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Remarks

The ModelMetadataProviders class sets this class as the default metadata provider for the MVC framework. You typically do not have to use this class directly. If you develop a custom attribute-based metadata provider, you can use this implementation as a guide.

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