Export (0) Print
Expand All

ModelMetadata Class

.NET Framework 4

Provides a container for common metadata, for the ModelMetadataProvider class, and for the ModelValidator class for a data model.

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

public class ModelMetadata

The ModelMetadata type exposes the following members.

  NameDescription
Public methodModelMetadataInitializes a new instance of the ModelMetadata class.
Top

  NameDescription
Public propertyAdditionalValuesGets a dictionary that contains additional metadata about the model.
Public propertyContainerTypeGets or sets the type of the container for the model.
Public propertyConvertEmptyStringToNullGets or sets a value that indicates whether empty strings that are posted back in forms should be converted to null.
Public propertyDataTypeNameGets or sets meta information about the data type.
Public propertyDescriptionGets or sets the description of the model.
Public propertyDisplayFormatStringGets or sets the display format string for the model.
Public propertyDisplayNameGets or sets the display name of the model.
Public propertyEditFormatStringGets or sets the edit format string of the model.
Public propertyHideSurroundingHtmlGets or sets a value that indicates whether the model object should be rendered using associated HTML elements.
Public propertyIsComplexTypeGets or sets a value that indicates whether the model is a complex type.
Public propertyIsNullableValueTypeGets a value that indicates whether the type is nullable.
Public propertyIsReadOnlyGets or sets a value that indicates whether the model is read-only.
Public propertyIsRequiredGets or sets a value that indicates whether the model is required.
Public propertyModelGets the value of the model.
Public propertyModelTypeGets the type of the model.
Public propertyNullDisplayTextGets or sets the string to display for null values.
Public propertyPropertiesGets a collection of model metadata objects that describe the properties of the model.
Public propertyPropertyNameGets the property name.
Protected propertyProviderGets or sets the provider.
Public propertyShortDisplayNameGets or sets a short display name.
Public propertyShowForDisplayGets or sets a value that indicates whether the property should be displayed in read-only views such as list and detail views.
Public propertyShowForEditGets or sets a value that indicates whether the model should be displayed in editable views.
Public propertySimpleDisplayTextGets or sets the simple display string for the model.
Public propertyTemplateHintGets or sets a hint that suggests what template to use for this model.
Public propertyWatermarkGets or sets a value that can be used as a watermark.
Top

  NameDescription
Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberFromLambdaExpression<TParameter, TValue>Gets the metadata from the Expression parameter for the model.
Public methodStatic memberFromStringExpressionGets the metadata from the expression parameter for the model.
Public methodGetDisplayNameGets the display name for the model.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Protected methodGetSimpleDisplayTextReturns the simple description of the model.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValidatorsGets a list of validators for the model.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This class is used by the DataAnnotationsModelMetadataProvider class, which is the default model metadata provider for MVC. By default, ModelMetadata objects are constructed using data taken from attributes, primarily from the System.ComponentModel and System.ComponentModel.DataAnnotations namespaces.

You can specify an alternative model metadata provider. For more information about ModelMetadata, see the entry ASP.NET MVC 2 Templates, Part 2: ModelMetadata on Brad Wilson's blog.

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

Community Additions

ADD
Show:
© 2014 Microsoft