Class AssociatedMetadataProvider
Provides an abstract class to implement a metadata provider.
public abstract class AssociatedMetadataProvider : ModelMetadataProvider
- Inheritance
-
AssociatedMetadataProvider
- Derived
- Inherited Members
Constructors
AssociatedMetadataProvider()
Called from constructors in a derived class to initialize the AssociatedMetadataProvider class.
protected AssociatedMetadataProvider()
Methods
CreateMetadata(IEnumerable<Attribute>, Type, Func<object>, Type, string)
When overridden in a derived class, creates the model metadata for the property.
protected abstract ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
Parameters
attributesIEnumerable<Attribute>The set of attributes.
containerTypeTypeThe type of the container.
modelAccessorFunc<object>The model accessor.
modelTypeTypeThe type of the model.
propertyNamestringThe name of the property.
Returns
- ModelMetadata
The model metadata for the property.
FilterAttributes(Type, PropertyDescriptor, IEnumerable<Attribute>)
Gets a list of attributes.
protected virtual IEnumerable<Attribute> FilterAttributes(Type containerType, PropertyDescriptor propertyDescriptor, IEnumerable<Attribute> attributes)
Parameters
containerTypeTypeThe type of the container.
propertyDescriptorPropertyDescriptorThe property descriptor.
attributesIEnumerable<Attribute>The attribute container.
Returns
- IEnumerable<Attribute>
A list of attributes.
GetMetadataForProperties(object, Type)
Returns a list of properties for the model.
public override IEnumerable<ModelMetadata> GetMetadataForProperties(object container, Type containerType)
Parameters
Returns
- IEnumerable<ModelMetadata>
A list of properties for the model.
GetMetadataForProperty(Func<object>, Type, PropertyDescriptor)
Returns the metadata for the specified property using the container type and property descriptor.
protected virtual ModelMetadata GetMetadataForProperty(Func<object> modelAccessor, Type containerType, PropertyDescriptor propertyDescriptor)
Parameters
modelAccessorFunc<object>The model accessor.
containerTypeTypeThe type of the container.
propertyDescriptorPropertyDescriptorThe property descriptor
Returns
- ModelMetadata
The metadata for the specified property using the container type and property descriptor.
GetMetadataForProperty(Func<object>, Type, string)
Returns the metadata for the specified property using the container type and property name.
public override ModelMetadata GetMetadataForProperty(Func<object> modelAccessor, Type containerType, string propertyName)
Parameters
modelAccessorFunc<object>The model accessor.
containerTypeTypeThe type of the container.
propertyNamestringThe name of the property.
Returns
- ModelMetadata
The metadata for the specified property using the container type and property name.
GetMetadataForType(Func<object>, Type)
Returns the metadata for the specified property using the type of the model.
public override ModelMetadata GetMetadataForType(Func<object> modelAccessor, Type modelType)
Parameters
Returns
- ModelMetadata
The metadata for the specified property using the type of the model.
GetTypeDescriptor(Type)
Returns the type descriptor from the specified type.
protected virtual ICustomTypeDescriptor GetTypeDescriptor(Type type)
Parameters
typeTypeThe type.
Returns
- ICustomTypeDescriptor
The type descriptor.