Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ModelMetadata Class

 

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

NameDescription
System_CAPS_pubmethodModelMetadata(ModelMetadataProvider, Type, Func<Object>, Type, String)

Initializes a new instance of the ModelMetadata class.

NameDescription
System_CAPS_pubpropertyAdditionalValues

Gets a dictionary that contains additional metadata about the model.

System_CAPS_pubpropertyContainer

A reference to the model's container object. Will be non-null if the model represents a property.

System_CAPS_pubpropertyContainerType

Gets or sets the type of the container for the model.

System_CAPS_pubpropertyConvertEmptyStringToNull

Gets or sets a value that indicates whether empty strings that are posted back in forms should be converted to null.

System_CAPS_pubpropertyDataTypeName

Gets or sets meta information about the data type.

System_CAPS_pubpropertyDescription

Gets or sets the description of the model.

System_CAPS_pubpropertyDisplayFormatString

Gets or sets the display format string for the model.

System_CAPS_pubpropertyDisplayName

Gets or sets the display name of the model.

System_CAPS_pubpropertyEditFormatString

Gets or sets the edit format string of the model.

System_CAPS_pubpropertyHideSurroundingHtml

Gets or sets a value that indicates whether the model object should be rendered using associated HTML elements.

System_CAPS_pubpropertyHtmlEncode

System_CAPS_pubpropertyIsComplexType

Gets or sets a value that indicates whether the model is a complex type.

System_CAPS_pubpropertyIsNullableValueType

Gets a value that indicates whether the type is nullable.

System_CAPS_pubpropertyIsReadOnly

Gets or sets a value that indicates whether the model is read-only.

System_CAPS_pubpropertyIsRequired

Gets or sets a value that indicates whether the model is required.

System_CAPS_pubpropertyModel

Gets the value of the model.

System_CAPS_pubpropertyModelType

Gets the type of the model.

System_CAPS_pubpropertyNullDisplayText

Gets or sets the string to display for null values.

System_CAPS_pubpropertyOrder

Gets or sets a value that represents order of the current metadata.

System_CAPS_pubpropertyProperties

Gets a collection of model metadata objects that describe the properties of the model.

System_CAPS_pubpropertyPropertyName

Gets the property name.

System_CAPS_protpropertyProvider

Gets or sets the provider.

System_CAPS_pubpropertyRequestValidationEnabled

Gets or sets a value that indicates whether request validation is enabled.

System_CAPS_pubpropertyShortDisplayName

Gets or sets a short display name.

System_CAPS_pubpropertyShowForDisplay

Gets or sets a value that indicates whether the property should be displayed in read-only views such as list and detail views.

System_CAPS_pubpropertyShowForEdit

Gets or sets a value that indicates whether the model should be displayed in editable views.

System_CAPS_pubpropertySimpleDisplayText

Gets or sets the simple display string for the model.

System_CAPS_pubpropertyTemplateHint

Gets or sets a hint that suggests what template to use for this model.

System_CAPS_pubpropertyWatermark

Gets or sets a value that can be used as a watermark.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticFromLambdaExpression<TParameter, TValue>(Expression<Func<TParameter, TValue>>, ViewDataDictionary<TParameter>)

Returns the metadata from the Expression parameter for the model.

System_CAPS_pubmethodSystem_CAPS_staticFromStringExpression(String, ViewDataDictionary)

Gets the metadata from the expression parameter for the model.

System_CAPS_pubmethodGetDisplayName()

Gets the display name for the model.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_protmethodGetSimpleDisplayText()

Returns the simple description of the model.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodGetValidators(ControllerContext)

Gets a list of validators for the model.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticDefaultOrder

The default order value, which is 10000.

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.

Return to top
Show:
© 2015 Microsoft