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)

'Declaration
Public Class ModelMetadata
'Usage
Dim instance As 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 Nothing.
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 propertyOrderGets or sets a value that represents order of the current metadata.
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 propertyRequestValidationEnabledGets or sets a value that indicates whether request validation is enabled.
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 methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodStatic memberFromLambdaExpression(Of TParameter, TValue)Returns 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 methodGetHashCode (Inherited from Object.)
Protected methodGetSimpleDisplayTextReturns the simple description of the model.
Public methodGetType (Inherited from Object.)
Public methodGetValidatorsGets a list of validators for the model.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberDefaultOrderThe default order value, which is 10000.
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.
Show:
© 2014 Microsoft