Class AssociatedMetadataProvider<TModelMetadata>
Provides an abstract class to implement a metadata provider.
public abstract class AssociatedMetadataProvider<TModelMetadata> : ModelMetadataProvider where TModelMetadata : ModelMetadata
Type Parameters
TModelMetadata
The type of the model metadata.
- Inheritance
-
AssociatedMetadataProvider<TModelMetadata>
- Derived
- Inherited Members
Constructors
AssociatedMetadataProvider()
Initializes a new instance of the AssociatedMetadataProvider<TModelMetadata> class.
protected AssociatedMetadataProvider()
Methods
CreateMetadataFromPrototype(TModelMetadata, Func<object>)
When overridden in a derived class, creates the model metadata for the property using the specified prototype.
protected abstract TModelMetadata CreateMetadataFromPrototype(TModelMetadata prototype, Func<object> modelAccessor)
Parameters
prototype
TModelMetadataThe prototype from which to create the model metadata.
modelAccessor
Func<object>The model accessor.
Returns
- TModelMetadata
The model metadata for the property.
CreateMetadataPrototype(IEnumerable<Attribute>, Type, Type, string)
When overridden in a derived class, creates the model metadata for the property.
protected abstract TModelMetadata CreateMetadataPrototype(IEnumerable<Attribute> attributes, Type containerType, Type modelType, string propertyName)
Parameters
attributes
IEnumerable<Attribute>The set of attributes.
containerType
TypeThe type of the container.
modelType
TypeThe type of the model.
propertyName
stringThe name of the property.
Returns
- TModelMetadata
The model metadata for the property.
GetMetadataForProperties(object, Type)
Retrieves a list of properties for the model.
public override sealed IEnumerable<ModelMetadata> GetMetadataForProperties(object container, Type containerType)
Parameters
Returns
- IEnumerable<ModelMetadata>
A list of properties for the model.
GetMetadataForProperty(Func<object>, Type, string)
Retrieves the metadata for the specified property using the container type and property name.
public override sealed ModelMetadata GetMetadataForProperty(Func<object> modelAccessor, Type containerType, string propertyName)
Parameters
modelAccessor
Func<object>The model accessor.
containerType
TypeThe type of the container.
propertyName
stringThe name of the property.
Returns
- ModelMetadata
The metadata for the specified property.
GetMetadataForType(Func<object>, Type)
Returns the metadata for the specified property using the type of the model.
public override sealed ModelMetadata GetMetadataForType(Func<object> modelAccessor, Type modelType)
Parameters
Returns
- ModelMetadata
The metadata for the specified property.