Class CachedAssociatedMetadataProvider<TModelMetadata>
Provides an abstract class to implement a cached metadata provider.
public abstract class CachedAssociatedMetadataProvider<TModelMetadata> : AssociatedMetadataProvider where TModelMetadata : ModelMetadata
Type Parameters
TModelMetadata
- Inheritance
-
CachedAssociatedMetadataProvider<TModelMetadata>
- Derived
- Inherited Members
Constructors
CachedAssociatedMetadataProvider()
Initializes a new instance of the CachedAssociatedMetadataProvider<TModelMetadata> class.
protected CachedAssociatedMetadataProvider()
Properties
CacheItemPolicy
Gets the cache item policy.
protected CacheItemPolicy CacheItemPolicy { get; set; }
Property Value
- CacheItemPolicy
The cache item policy.
CacheKeyPrefix
Gets the cache key prefix.
protected string CacheKeyPrefix { get; }
Property Value
- string
The cache key prefix.
PrototypeCache
Gets the prototype cache.
protected ObjectCache PrototypeCache { get; set; }
Property Value
- ObjectCache
The prototype cache.
Methods
CreateMetadata(IEnumerable<Attribute>, Type, Func<object>, Type, string)
When overridden in a derived class, creates the cached model metadata for the property.
protected override sealed ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
Parameters
attributes
IEnumerable<Attribute>The attributes.
containerType
TypeThe container type.
modelAccessor
Func<object>The model accessor.
modelType
TypeThe model type.
propertyName
stringThe property name.
Returns
- ModelMetadata
The cached model metadata for the property.
CreateMetadataFromPrototype(TModelMetadata, Func<object>)
Creates prototype metadata by applying the prototype and model access to yield the final metadata.
protected abstract TModelMetadata CreateMetadataFromPrototype(TModelMetadata prototype, Func<object> modelAccessor)
Parameters
Returns
- TModelMetadata
The prototype metadata.
CreateMetadataPrototype(IEnumerable<Attribute>, Type, Type, string)
Creates a metadata prototype.
protected abstract TModelMetadata CreateMetadataPrototype(IEnumerable<Attribute> attributes, Type containerType, Type modelType, string propertyName)
Parameters
attributes
IEnumerable<Attribute>The attributes.
containerType
TypeThe container type.
modelType
TypeThe model type.
propertyName
stringThe property name.
Returns
- TModelMetadata
A metadata prototype.
GetMetadataForProperties(object, Type)
Gets the metadata for the properties.
public override sealed IEnumerable<ModelMetadata> GetMetadataForProperties(object container, Type containerType)
Parameters
Returns
- IEnumerable<ModelMetadata>
The metadata for the properties.
GetMetadataForProperty(Func<object>, Type, PropertyDescriptor)
Returns the metadata for the specified property.
protected override sealed ModelMetadata GetMetadataForProperty(Func<object> modelAccessor, Type containerType, PropertyDescriptor propertyDescriptor)
Parameters
modelAccessor
Func<object>The model accessor.
containerType
TypeThe container type.
propertyDescriptor
PropertyDescriptorThe property descriptor.
Returns
- ModelMetadata
The metadata for the specified property.
GetMetadataForProperty(Func<object>, Type, string)
Returns the metadata for the specified property.
public override sealed ModelMetadata GetMetadataForProperty(Func<object> modelAccessor, Type containerType, string propertyName)
Parameters
modelAccessor
Func<object>The model accessor.
containerType
TypeThe container type.
propertyName
stringThe property name.
Returns
- ModelMetadata
The metadata for the specified property.
GetMetadataForType(Func<object>, Type)
Returns the cached 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 cached metadata for the specified property using the type of the model.