/// <summary> /// Creates the <see cref="DefaultMetadataDetails"/> entry for a model <see cref="Type"/>. /// </summary> /// <param name="key"> /// The <see cref="ModelMetadataIdentity"/> identifying the model <see cref="Type"/>. /// </param> /// <returns>A details object for the model <see cref="Type"/>.</returns> /// <remarks> /// The results of this method will be cached and used to satisfy calls to /// <see cref="GetMetadataForType(Type)"/>. Override this method to provide a different /// set of attributes. /// </remarks> protected virtual DefaultMetadataDetails CreateTypeDetails(ModelMetadataIdentity key) { return(new DefaultMetadataDetails(key, ModelAttributes.GetAttributesForType(key.ModelType))); }
private ModelMetadataCacheEntry GetCacheEntry(ConstructorInfo constructor, Type modelType) { return(_modelMetadataCache.GetOrAdd( ModelMetadataIdentity.ForConstructor(constructor, modelType), _cacheEntryFactory)); }
private ModelMetadataCacheEntry GetCacheEntry(ParameterInfo parameter, Type modelType) { return(_modelMetadataCache.GetOrAdd( ModelMetadataIdentity.ForParameter(parameter, modelType), _cacheEntryFactory)); }
private ModelMetadataCacheEntry GetCacheEntry(PropertyInfo property, Type modelType) { return(_modelMetadataCache.GetOrAdd( ModelMetadataIdentity.ForProperty(property, modelType, property.DeclaringType !), _cacheEntryFactory)); }
protected virtual DefaultMetadataDetails CreateParameterDetails(ModelMetadataIdentity key) { return(new DefaultMetadataDetails( key, ModelAttributes.GetAttributesForParameter(key.ParameterInfo))); }