ModelMetadata ModelMetadata ModelMetadata ModelMetadata Class

Definition

A metadata representation of a model type, property or parameter.

public ref class ModelMetadata abstract : IEquatable<Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^>, Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider
public abstract class ModelMetadata : IEquatable<Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata>, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider
type ModelMetadata = class
    interface IModelMetadataProvider
    interface IEquatable<ModelMetadata>
Public MustInherit Class ModelMetadata
Implements IEquatable(Of ModelMetadata), IModelMetadataProvider
Inheritance
ModelMetadataModelMetadataModelMetadataModelMetadata
Derived
Implements

Constructors

ModelMetadata(ModelMetadataIdentity) ModelMetadata(ModelMetadataIdentity) ModelMetadata(ModelMetadataIdentity) ModelMetadata(ModelMetadataIdentity)

Creates a new ModelMetadata.

Fields

DefaultOrder DefaultOrder DefaultOrder DefaultOrder

The default value of Order.

Properties

AdditionalValues AdditionalValues AdditionalValues AdditionalValues

Gets a collection of additional information about the model.

BinderModelName BinderModelName BinderModelName BinderModelName

Gets the name of a model if specified explicitly using IModelNameProvider.

BinderType BinderType BinderType BinderType

Gets the Type of an IModelBinder of a model if specified explicitly using IBinderTypeProviderMetadata.

BindingSource BindingSource BindingSource BindingSource

Gets a binder metadata for this model.

ContainerMetadata ContainerMetadata ContainerMetadata ContainerMetadata

Gets the metadata for ContainerType if this metadata is for a property; null otherwise.

ContainerType ContainerType ContainerType ContainerType

Gets the type containing the property if this metadata is for a property; null otherwise.

ConvertEmptyStringToNull ConvertEmptyStringToNull ConvertEmptyStringToNull ConvertEmptyStringToNull

Gets a value indicating whether or not to convert an empty string value or one containing only whitespace characters to null when representing a model as text.

DataTypeName DataTypeName DataTypeName DataTypeName

Gets the name of the model's datatype. Overrides ModelType in some display scenarios.

Description Description Description Description

Gets the description of the model.

DisplayFormatString DisplayFormatString DisplayFormatString DisplayFormatString

Gets the format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to display the model.

DisplayName DisplayName DisplayName DisplayName

Gets the display name of the model.

EditFormatString EditFormatString EditFormatString EditFormatString

Gets the format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to edit the model.

ElementMetadata ElementMetadata ElementMetadata ElementMetadata

Gets the ModelMetadata for elements of ModelType if that Type implements IEnumerable.

ElementType ElementType ElementType ElementType

Gets the Type for elements of ModelType if that Type implements IEnumerable.

EnumGroupedDisplayNamesAndValues EnumGroupedDisplayNamesAndValues EnumGroupedDisplayNamesAndValues EnumGroupedDisplayNamesAndValues

Gets the ordered and grouped display names and values of all Enum values in UnderlyingOrModelType.

EnumNamesAndValues EnumNamesAndValues EnumNamesAndValues EnumNamesAndValues

Gets the names and values of all Enum values in UnderlyingOrModelType.

HasNonDefaultEditFormat HasNonDefaultEditFormat HasNonDefaultEditFormat HasNonDefaultEditFormat

Gets a value indicating whether EditFormatString has a non-null, non-empty value different from the default for the datatype.

HasValidators HasValidators HasValidators HasValidators

Gets a value that indicates if the model, or one of it's properties, or elements has associated validators.

HideSurroundingHtml HideSurroundingHtml HideSurroundingHtml HideSurroundingHtml

Gets a value indicating whether the "HiddenInput" display template should return string.Empty (not the expression value) and whether the "HiddenInput" editor template should not also return the expression value (together with the hidden <input> element).

HtmlEncode HtmlEncode HtmlEncode HtmlEncode

Gets a value indicating whether the value should be HTML-encoded.

Identity Identity Identity Identity

Gets the key for the current instance.

IsBindingAllowed IsBindingAllowed IsBindingAllowed IsBindingAllowed

Gets a value indicating whether or not the model value can be bound by model binding. This is only applicable when the current instance represents a property.

IsBindingRequired IsBindingRequired IsBindingRequired IsBindingRequired

Gets a value indicating whether or not the model value is required by model binding. This is only applicable when the current instance represents a property.

IsCollectionType IsCollectionType IsCollectionType IsCollectionType

Gets a value indicating whether or not ModelType is a collection type.

IsComplexType IsComplexType IsComplexType IsComplexType

Gets a value indicating whether ModelType is a complex type.

IsEnum IsEnum IsEnum IsEnum

Gets a value indicating whether UnderlyingOrModelType is for an Enum.

IsEnumerableType IsEnumerableType IsEnumerableType IsEnumerableType

Gets a value indicating whether or not ModelType is an enumerable type.

IsFlagsEnum IsFlagsEnum IsFlagsEnum IsFlagsEnum

Gets a value indicating whether UnderlyingOrModelType is for an Enum with an associated FlagsAttribute.

IsNullableValueType IsNullableValueType IsNullableValueType IsNullableValueType

Gets a value indicating whether or not ModelType is a Nullable<T>.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether or not the model value is read-only. This is only applicable when the current instance represents a property.

IsReferenceOrNullableType IsReferenceOrNullableType IsReferenceOrNullableType IsReferenceOrNullableType

Gets a value indicating whether or not ModelType allows null values.

IsRequired IsRequired IsRequired IsRequired

Gets a value indicating whether or not the model value is required. This is only applicable when the current instance represents a property.

MetadataKind MetadataKind MetadataKind MetadataKind

Gets a value indicating the kind of metadata element represented by the current instance.

ModelBindingMessageProvider ModelBindingMessageProvider ModelBindingMessageProvider ModelBindingMessageProvider

Gets the ModelBindingMessageProvider instance.

ModelType ModelType ModelType ModelType

Gets the model type represented by the current instance.

Name Name Name Name

Gets the name of the parameter or property if this metadata is for a parameter or property; null otherwise i.e. if this is the metadata for a type.

NullDisplayText NullDisplayText NullDisplayText NullDisplayText

Gets the text to display when the model is null.

Order Order Order Order

Gets a value indicating where the current metadata should be ordered relative to other properties in its containing type.

ParameterName ParameterName ParameterName ParameterName

Gets the name of the parameter if this metadata is for a parameter; null otherwise.

Placeholder Placeholder Placeholder Placeholder

Gets the text to display as a placeholder value for an editor.

Properties Properties Properties Properties

Gets the collection of ModelMetadata instances for the model's properties.

PropertyFilterProvider PropertyFilterProvider PropertyFilterProvider PropertyFilterProvider

Gets the IPropertyFilterProvider, which can determine which properties should be model bound.

PropertyGetter PropertyGetter PropertyGetter PropertyGetter

Gets a property getter delegate to get the property value from a model object.

PropertyName PropertyName PropertyName PropertyName

Gets the name of the property if this metadata is for a property; null otherwise.

PropertySetter PropertySetter PropertySetter PropertySetter

Gets a property setter delegate to set the property value on a model object.

PropertyValidationFilter PropertyValidationFilter PropertyValidationFilter PropertyValidationFilter

Gets an IPropertyValidationFilter implementation that indicates whether this model should be validated. If null, properties with this ModelMetadata are validated.

ShowForDisplay ShowForDisplay ShowForDisplay ShowForDisplay

Gets a value that indicates whether the property should be displayed in read-only views.

ShowForEdit ShowForEdit ShowForEdit ShowForEdit

Gets a value that indicates whether the property should be displayed in editable views.

SimpleDisplayProperty SimpleDisplayProperty SimpleDisplayProperty SimpleDisplayProperty

Gets a value which is the name of the property used to display the model.

TemplateHint TemplateHint TemplateHint TemplateHint

Gets a string used by the templating system to discover display-templates and editor-templates.

UnderlyingOrModelType UnderlyingOrModelType UnderlyingOrModelType UnderlyingOrModelType

Gets the underlying type argument if ModelType inherits from Nullable<T>. Otherwise gets ModelType.

ValidateChildren ValidateChildren ValidateChildren ValidateChildren

Gets a value that indicates whether properties or elements of the model should be validated.

ValidatorMetadata ValidatorMetadata ValidatorMetadata ValidatorMetadata

Gets a collection of metadata items for validators.

Methods

Equals(ModelMetadata) Equals(ModelMetadata) Equals(ModelMetadata) Equals(ModelMetadata)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)
GetDisplayName() GetDisplayName() GetDisplayName() GetDisplayName()

Gets a display name for the model.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()
GetMetadataForProperties(Type) GetMetadataForProperties(Type) GetMetadataForProperties(Type) GetMetadataForProperties(Type)
GetMetadataForType(Type) GetMetadataForType(Type) GetMetadataForType(Type) GetMetadataForType(Type)

Extension Methods

GetMetadataForProperty(IModelMetadataProvider, Type, String) GetMetadataForProperty(IModelMetadataProvider, Type, String) GetMetadataForProperty(IModelMetadataProvider, Type, String) GetMetadataForProperty(IModelMetadataProvider, Type, String)

Gets a ModelMetadata for property identified by the provided containerType and propertyName.

GetModelExplorerForType(IModelMetadataProvider, Type, Object) GetModelExplorerForType(IModelMetadataProvider, Type, Object) GetModelExplorerForType(IModelMetadataProvider, Type, Object) GetModelExplorerForType(IModelMetadataProvider, Type, Object)

Gets a ModelExplorer for the provided modelType and model.

Applies to