Export (0) Print
Expand All

ModelMetadata Class

.NET Framework 4.5

Provides a container for metadata for a model.

Namespace:  System.Web.ModelBinding
Assembly:  System.Web (in System.Web.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 collection that contains additional metadata about the model.
Public propertyContainerTypeGets the type of the container.
Public propertyConvertEmptyStringToNullGets or sets a value that determines whether empty strings that are submitted in forms should be converted to null.
Public propertyDataTypeNameGets or sets the name of the data type.
Public propertyDescriptionGets or sets text that describes the model.
Public propertyDisplayFormatStringGets or sets a format string that should be applied when the model is displayed in display mode (as opposed to in edit mode).
Public propertyDisplayNameGets or sets the text to use in UI when the name of the model is displayed.
Public propertyEditFormatStringGets or sets the format string to use in UI in edit mode.
Public propertyHideSurroundingHtmlGets or sets a value that determines whether surrounding HTML should be hidden.
Public propertyIsComplexTypeGets a value that specifies whether the model is a complex type.
Public propertyIsNullableValueTypeGets a value that specifies whether the model is a nullable value type.
Public propertyIsReadOnlyGets or sets a value that specifies whether the model can be updated.
Public propertyIsRequiredGets or sets a value that specifies whether the property is required.
Public propertyModelGets or sets the model object.
Public propertyModelTypeGets the type of the model.
Public propertyNullDisplayTextGets the string that should be displayed when the model is null.
Public propertyOrderGets or sets an integer that indicates the order in which to display this property relative to other properties.
Public propertyPropertiesGets a collection of model metadata objects that describe the properties of the model.
Public propertyPropertyNameGets the name of the property.
Protected propertyProviderGets or sets the provider object for this metadata.
Public propertyRequestValidationEnabledGets or sets a value that specifies whether request validation is enabled.
Public propertyShortDisplayNameGets or sets a short version of the display name.
Public propertyShowForDisplayGets or sets a value that specifies whether the model should be displayed in the UI in display mode (as opposed to edit mode).
Public propertyShowForEditGets or sets a value that specifies whether the property should be displayed in edit mode (as opposed to display mode).
Public propertySimpleDisplayTextGets or sets text to display for the model when the model represents a complex object
Public propertyTemplateHintGets or sets a value that indicates what template (data control) should be used in UI for the model.
Public propertyWatermarkGets or sets watermark text for a text box.
Top

  NameDescription
Public methodEquals(Object)Determines 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 methodGetDisplayNameReturns text to display as the name of the model in UI.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetSimpleDisplayTextReturns text to display for the model when the model represents a complex object.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValidatorsReturns a collection of validators that apply to 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

  NameDescription
Public fieldStatic memberDefaultOrderAn integer value that is always set to 10000.
Top

The word model is used differently in the context of this class than it is typically used elsewhere. In an ASP.NET Web Forms application, the ModelType attribute of a data-bound control specifies the type of a data element that the data control is bound to. This type is typically referred to as the model, and it typically corresponds to a row in a database table. The properties of the model typically correspond to columns of the table.

A ModelMetadata object can provide metadata for the model itself or for a property of the model, or for a property of a complex property. When the ModelMetadata object pertains to a property, the word model refers to the property, and the word container refers to the model.

For example, the model might be Contact, which has Name and Age properties, and the Name property might be a complex property composed of FirstName and LastName. When the ModelMetadata object pertains to the Contact object, the model type is Contact and there is no container. When the ModelMetadata object pertains to the Name property, the model type is Name and the container type is Contact. When the ModelMetadata object pertains to the FirstName property, the model type is FirstName and the container type is Name.

.NET Framework

Supported in: 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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