Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AssociatedMetadataProvider Class

 

Provides an abstract class to implement a metadata provider.

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


public abstract class AssociatedMetadataProvider : ModelMetadataProvider

NameDescription
System_CAPS_protmethodAssociatedMetadataProvider()

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

NameDescription
System_CAPS_protmethodCreateMetadata(IEnumerable<Attribute>, Type, Func<Object>, Type, String)

When overridden in a derived class, creates the model metadata for the property.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFilterAttributes(Type, PropertyDescriptor, IEnumerable<Attribute>)

Gets a list of attributes.

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetMetadataForProperties(Object, Type)

Returns a list of properties for the model.(Overrides ModelMetadataProvider.GetMetadataForProperties(Object, Type).)

System_CAPS_protmethodGetMetadataForProperty(Func<Object>, Type, PropertyDescriptor)

Returns the metadata for the specified property using the container type and property descriptor.

System_CAPS_pubmethodGetMetadataForProperty(Func<Object>, Type, String)

Returns the metadata for the specified property using the container type and property name.(Overrides ModelMetadataProvider.GetMetadataForProperty(Func<Object>, Type, String).)

System_CAPS_pubmethodGetMetadataForType(Func<Object>, Type)

Returns the metadata for the specified property using the type of the model.(Overrides ModelMetadataProvider.GetMetadataForType(Func<Object>, Type).)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodGetTypeDescriptor(Type)

Returns the type descriptor from the specified type.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

A metadata provider provides metadata for the model within a view. Metadata providers must derive from ModelMetadataProvider. You can inherit from this class if you want to use a custom validator or a third-party validator that uses attribute-based metadata.

This class implements the abstract methods of ModelMetadataProvider and contains only one additional abstract method. When you implement this class, use the AssociatedValidatorProvider class to implement the validator.

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.

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

Return to top
Show:
© 2015 Microsoft