Delen via


ModelMetadata Class

Definition

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

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

Constructors

ModelMetadata(ModelMetadataIdentity)

Creates a new ModelMetadata.

Fields

DefaultOrder

The default value of Order.

Properties

AdditionalValues

Gets a collection of additional information about the model.

BinderModelName

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

BinderType

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

BindingSource

Gets a binder metadata for this model.

BoundConstructor

Gets ModelMetadata instance for a constructor of a record type that is used during binding and validation.

BoundConstructorInvoker

Gets a delegate that invokes the bound constructor BoundConstructor if non-null.

BoundConstructorParameters

Gets the collection of ModelMetadata instances for parameters on a BoundConstructor. This is only available when MetadataKind is Constructor.

ContainerMetadata

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

ContainerType

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

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

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

Description

Gets the description of the model.

DisplayFormatString

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

DisplayName

Gets the display name of the model.

EditFormatString

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

ElementMetadata

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

ElementType

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

EnumGroupedDisplayNamesAndValues

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

EnumNamesAndValues

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

HasNonDefaultEditFormat

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

HasValidators

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

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

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

Identity

Gets the key for the current instance.

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

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

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

IsComplexType

Gets a value indicating whether ModelType is a complex type.

IsEnum

Gets a value indicating whether UnderlyingOrModelType is for an Enum.

IsEnumerableType

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

IsFlagsEnum

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

IsNullableValueType

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

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

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

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

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

ModelBindingMessageProvider

Gets the ModelBindingMessageProvider instance.

ModelType

Gets the model type represented by the current instance.

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

Gets the text to display when the model is null.

Order

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

ParameterName

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

Placeholder

Gets the text to display as a placeholder value for an editor. By default, this is configured using Prompt.

Properties

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

PropertyFilterProvider

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

PropertyGetter

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

PropertyName

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

PropertySetter

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

PropertyValidationFilter

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

ShowForDisplay

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

ShowForEdit

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

SimpleDisplayProperty

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

TemplateHint

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

UnderlyingOrModelType

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

ValidateChildren

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

ValidatorMetadata

Gets a collection of metadata items for validators.

Methods

Equals(ModelMetadata)

Indicates whether the current object is equal to another object of the same type.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetDisplayName()

Gets a display name for the model.

GetHashCode()

Serves as the default hash function.

GetMetadataForProperties(Type)

Supplies metadata describing the properties of a Type.

GetMetadataForType(Type)

Supplies metadata describing a Type.

Extension Methods

GetMetadataForProperty(IModelMetadataProvider, Type, String)

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

GetModelExplorerForType(IModelMetadataProvider, Type, Object)

Gets a ModelExplorer for the provided modelType and model.

Applies to