Share via


DataAnnotationsModelMetadata Class

Provides a container for common metadata, for the DataAnnotationsModelMetadataProvider class, and for the DataAnnotationsModelValidator class for a data model.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.ModelMetadata
    System.Web.Mvc.DataAnnotationsModelMetadata

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

Syntax

'Declaration
Public Class DataAnnotationsModelMetadata _
    Inherits ModelMetadata
public class DataAnnotationsModelMetadata : ModelMetadata
public ref class DataAnnotationsModelMetadata : public ModelMetadata

The DataAnnotationsModelMetadata type exposes the following members.

Constructors

  Name Description
Public method DataAnnotationsModelMetadata Initializes a new instance of the DataAnnotationsModelMetadataProvider class.

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 value that indicates whether empty strings that are posted back in forms should be converted to null reference (Nothing in Visual Basic). (Inherited from ModelMetadata.)
Public property DataTypeName Gets or sets meta information about the data type. (Inherited from ModelMetadata.)
Public property Description Gets or sets the description of the model. (Inherited from ModelMetadata.)
Public property DisplayFormatString Gets or sets the display format string for the model. (Inherited from ModelMetadata.)
Public property DisplayName Gets or sets the display name of the model. (Inherited from ModelMetadata.)
Public property EditFormatString Gets or sets the edit format string of the model. (Inherited from ModelMetadata.)
Public property HideSurroundingHtml Gets or sets a value that indicates whether the model object should be rendered using associated HTML elements. (Inherited from ModelMetadata.)
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. (Inherited from ModelMetadata.)
Public property IsRequired Gets or sets a value that indicates whether the model is required. (Inherited from ModelMetadata.)
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. (Inherited from ModelMetadata.)
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 Provider Gets or sets the provider. (Inherited from ModelMetadata.)
Public property ShortDisplayName Gets or sets a short display name. (Inherited from ModelMetadata.)
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. (Inherited from ModelMetadata.)
Public property ShowForEdit Gets or sets a value that indicates whether the model should be displayed in editable views. (Inherited from ModelMetadata.)
Public property SimpleDisplayText Gets or sets the simple display string for the model. (Inherited from ModelMetadata.)
Public property TemplateHint Gets or sets a hint that suggests what template to use for this model. (Inherited from ModelMetadata.)
Public property Watermark Gets or sets a value that can be used as a watermark. (Inherited from ModelMetadata.)

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetDisplayName Gets the display name for the model. (Inherited from ModelMetadata.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Protected method GetSimpleDisplayText Returns simple text for the model data. (Overrides ModelMetadata.GetSimpleDisplayText().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValidators Gets a list of validators for the model. (Inherited from ModelMetadata.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

DataAnnotationsModelMetadataProvider is the default metadata provider for MVC.

Examples

A Visual Studio project with source code is available to accompany this topic: Download.

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