Table of Contents

Class ModelMetadata

Namespace
System.Web.Http.Metadata
Assembly
System.Web.Http.dll

No content here will be updated; please do not add material here.

public class ModelMetadata
Inheritance
ModelMetadata
Derived
Inherited Members

Constructors

ModelMetadata(ModelMetadataProvider, Type, Func<object>, Type, string)

Initializes a new instance of the ModelMetadata class.

public ModelMetadata(ModelMetadataProvider provider, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)

Parameters

provider ModelMetadataProvider

The provider.

containerType Type

The type of the container.

modelAccessor Func<object>

The model accessor.

modelType Type

The type of the model.

propertyName string

The name of the property.

Properties

AdditionalValues

Gets a dictionary that contains additional metadata about the model.

public virtual Dictionary<string, object> AdditionalValues { get; }

Property Value

Dictionary<string, object>

A dictionary that contains additional metadata about the model.

ContainerType

Gets or sets the type of the container for the model.

public Type ContainerType { get; }

Property Value

Type

The type of the container for the model.

ConvertEmptyStringToNull

Gets or sets a value that indicates whether empty strings that are posted back in forms should be converted to null.

public virtual bool ConvertEmptyStringToNull { get; set; }

Property Value

bool

true if empty strings that are posted back in forms should be converted to null; otherwise, false. The default value is true.

Description

Gets or sets the description of the model.

public virtual string Description { get; set; }

Property Value

string

The description of the model. The default value is null.

IsComplexType

Gets or sets a value that indicates whether the model is a complex type.

public virtual bool IsComplexType { get; }

Property Value

bool

A value that indicates whether the model is considered a complex.

IsNullableValueType

Gets a value that indicates whether the type is nullable.

public bool IsNullableValueType { get; }

Property Value

bool

true if the type is nullable; otherwise, false.

IsReadOnly

Gets or sets a value that indicates whether the model is read-only.

public virtual bool IsReadOnly { get; set; }

Property Value

bool

true if the model is read-only; otherwise, false.

Model

Gets the value of the model.

public object Model { get; set; }

Property Value

object

The model value can be null.

ModelType

Gets the type of the model.

public Type ModelType { get; }

Property Value

Type

The type of the model.

Properties

Gets a collection of model metadata objects that describe the properties of the model.

public virtual IEnumerable<ModelMetadata> Properties { get; }

Property Value

IEnumerable<ModelMetadata>

A collection of model metadata objects that describe the properties of the model.

PropertyName

Gets the property name.

public string PropertyName { get; }

Property Value

string

The property name.

Provider

Gets or sets the provider.

protected ModelMetadataProvider Provider { get; set; }

Property Value

ModelMetadataProvider

The provider.

Methods

GetDisplayName()

Gets the display name for the model.

public string GetDisplayName()

Returns

string

The display name for the model.

GetValidators(IEnumerable<ModelValidatorProvider>)

Gets a list of validators for the model.

public virtual IEnumerable<ModelValidator> GetValidators(IEnumerable<ModelValidatorProvider> validatorProviders)

Parameters

validatorProviders IEnumerable<ModelValidatorProvider>

The validator providers for the model.

Returns

IEnumerable<ModelValidator>

A list of validators for the model.