CachedModelMetadata<TPrototypeCache> Class

Provides a container for cached metadata.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.ModelMetadata
    System.Web.Mvc.CachedModelMetadata<TPrototypeCache>
      System.Web.Mvc.CachedDataAnnotationsModelMetadata

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

Syntax

'Declaration
Public MustInherit Class CachedModelMetadata(Of TPrototypeCache) _
    Inherits ModelMetadata
'Usage
Dim instance As CachedModelMetadata(Of TPrototypeCache)
public abstract class CachedModelMetadata<TPrototypeCache> : ModelMetadata
generic<typename TPrototypeCache>
public ref class CachedModelMetadata abstract : public ModelMetadata
[<AbstractClassAttribute>]
type CachedModelMetadata<'TPrototypeCache> =  
    class 
        inherit ModelMetadata 
    end
JScript does not support generic types and methods.

Type Parameters

  • TPrototypeCache
    he type of the container.

The CachedModelMetadata<TPrototypeCache> type exposes the following members.

Constructors

  Name Description
Protected method CachedModelMetadata<TPrototypeCache>(CachedModelMetadata<TPrototypeCache>, Func<Object>) Constructor for creating the prototype instances of the metadata class.
Protected method CachedModelMetadata<TPrototypeCache>(CachedDataAnnotationsModelMetadataProvider, Type, Type, String, TPrototypeCache) Constructor for creating real instances of the metadata class based on a prototype.

Top

Properties

  Name Description
Public property AdditionalValues Gets a dictionary that contains additional metadata about the model. (Inherited from ModelMetadata.)
Public property ContainerType Gets or sets the type of the container for the model. (Inherited from ModelMetadata.)
Public property ConvertEmptyStringToNull Gets or sets a cached value that indicates whether empty strings that are posted back in forms should be converted to null. (Overrides ModelMetadata.ConvertEmptyStringToNull.)
Public property DataTypeName Gets or sets meta information about the data type. (Overrides ModelMetadata.DataTypeName.)
Public property Description Gets or sets the description of the model. (Overrides ModelMetadata.Description.)
Public property DisplayFormatString Gets or sets the display format string for the model. (Overrides ModelMetadata.DisplayFormatString.)
Public property DisplayName Gets or sets the display name of the model. (Overrides ModelMetadata.DisplayName.)
Public property EditFormatString Gets or sets the edit format string of the model. (Overrides ModelMetadata.EditFormatString.)
Public property HideSurroundingHtml Gets or sets a value that indicates whether the model object should be rendered using associated HTML elements. (Overrides ModelMetadata.HideSurroundingHtml.)
Public property IsComplexType Gets or sets a value that indicates whether the model is a complex type. (Inherited from ModelMetadata.)
Public property IsNullableValueType Gets a value that indicates whether the type is nullable. (Inherited from ModelMetadata.)
Public property IsReadOnly Gets or sets a value that indicates whether the model is read-only. (Overrides ModelMetadata.IsReadOnly.)
Public property IsRequired Gets or sets a value that indicates whether the model is required. (Overrides ModelMetadata.IsRequired.)
Public property Model Gets the value of the model. (Inherited from ModelMetadata.)
Public property ModelType Gets the type of the model. (Inherited from ModelMetadata.)
Public property NullDisplayText Gets or sets the string to display for null values. (Overrides ModelMetadata.NullDisplayText.)
Public property Order Gets or sets a value that represents order of the current metadata. (Overrides ModelMetadata.Order.)
Public property Properties Gets a collection of model metadata objects that describe the properties of the model. (Inherited from ModelMetadata.)
Public property PropertyName Gets the property name. (Inherited from ModelMetadata.)
Protected property PrototypeCache Gets or sets the prototype cache.
Protected property Provider Gets or sets the provider. (Inherited from ModelMetadata.)
Public property RequestValidationEnabled Gets or sets a value that indicates whether request validation is enabled. (Inherited from ModelMetadata.)
Public property ShortDisplayName Gets or sets a short display name. (Overrides ModelMetadata.ShortDisplayName.)
Public property ShowForDisplay Gets or sets a value that indicates whether the property should be displayed in read-only views such as list and detail views. (Overrides ModelMetadata.ShowForDisplay.)
Public property ShowForEdit Gets or sets a value that indicates whether the model should be displayed in editable views. (Overrides ModelMetadata.ShowForEdit.)
Public property SimpleDisplayText Gets or sets the simple display string for the model. (Overrides ModelMetadata.SimpleDisplayText.)
Public property TemplateHint Gets or sets a hint that suggests what template to use for this model. (Overrides ModelMetadata.TemplateHint.)
Public property Watermark Gets or sets a value that can be used as a watermark. (Overrides ModelMetadata.Watermark.)

Top

Methods

  Name Description
Protected method ComputeConvertEmptyStringToNull This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether empty strings that are posted back in forms should be converted to null reference (Nothing in Visual Basic).
Protected method ComputeDataTypeName This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets meta information about the data type.
Protected method ComputeDescription This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the description of the model.
Protected method ComputeDisplayFormatString This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the display format string for the model.
Protected method ComputeDisplayName This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the display name of the model.
Protected method ComputeEditFormatString This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the edit format string of the model.
Protected method ComputeHideSurroundingHtml This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether the model object should be rendered using associated HTML elements.
Protected method ComputeIsReadOnly This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether the model is read-only.
Protected method ComputeIsRequired This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether the model is required.
Protected method ComputeNullDisplayText This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the cached string to display for null values.
Protected method ComputeOrder This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that represents order of the current metadata.
Protected method ComputeShortDisplayName This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a short display name.
Protected method ComputeShowForDisplay This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether the property should be displayed in read-only views such as list and detail views.
Protected method ComputeShowForEdit This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that indicates whether the model should be displayed in editable views.
Protected method ComputeSimpleDisplayText This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets the cached simple display string for the model.
Protected method ComputeTemplateHint This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached hint that suggests what template to use for this model.
Protected method ComputeWatermark This method is protected and therefore cannot be called directly. This method was designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata.Gets or sets a cached value that can be used as a watermark.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetDisplayName Gets the display name for the model. (Inherited from ModelMetadata.)
Public method GetHashCode (Inherited from Object.)
Protected method GetSimpleDisplayText Gets or sets the simple display string for the model. (Overrides ModelMetadata.GetSimpleDisplayText().)
Public method GetType (Inherited from Object.)
Public method GetValidators Gets a list of validators for the model. (Inherited from ModelMetadata.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Remarks

This class assumes that model metadata is expensive to create, and allows the user to stash a cache object that can be copied around as a prototype to make creation and computation quicker. It delegates the retrieval of values to getter methods, the results of which are cached on a per metadata instance basis. This allows flexible caching strategies: either caching the source of information across instances or caching of the actual information itself, depending on what the developer decides to put into the prototype cache.

The ComputeXyz methods in CachedModelMetadata<TPrototypeCache> are designed to be overridden in a deriving class such as CachedDataAnnotationsModelMetadata. The methods ComputeXyz are protected, they can’t be called directly.

Thread Safety

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

See Also

Reference

System.Web.Mvc Namespace