AssociatedMetadataProvider.GetMetadataForProperty 方法

定义

当在派生类中重写时,将返回指定属性的元数据。When overridden in a derived class, returns metadata for a specified property.

重载

GetMetadataForProperty(Func<Object>, Type, PropertyDescriptor)

当在派生类中重写时,将为由属性描述符对象指定的属性返回元数据。When overridden in a derived class, returns metadata for a property specified by a property descriptor object.

GetMetadataForProperty(Func<Object>, Type, String)

当在派生类中重写时,将为由属性名称指定的属性返回元数据。When overridden in a derived class, returns metadata for a property specified by a property name.

GetMetadataForProperty(Func<Object>, Type, PropertyDescriptor)

当在派生类中重写时,将为由属性描述符对象指定的属性返回元数据。When overridden in a derived class, returns metadata for a property specified by a property descriptor object.

protected:
 virtual System::Web::ModelBinding::ModelMetadata ^ GetMetadataForProperty(Func<System::Object ^> ^ modelAccessor, Type ^ containerType, System::ComponentModel::PropertyDescriptor ^ propertyDescriptor);
protected virtual System.Web.ModelBinding.ModelMetadata GetMetadataForProperty (Func<object> modelAccessor, Type containerType, System.ComponentModel.PropertyDescriptor propertyDescriptor);
override this.GetMetadataForProperty : Func<obj> * Type * System.ComponentModel.PropertyDescriptor -> System.Web.ModelBinding.ModelMetadata
Protected Overridable Function GetMetadataForProperty (modelAccessor As Func(Of Object), containerType As Type, propertyDescriptor As PropertyDescriptor) As ModelMetadata

参数

modelAccessor
Func<Object>

模型访问器。The model accessor.

containerType
Type

容器的类型。The type of the container.

propertyDescriptor
PropertyDescriptor

属性描述符。The property descriptor.

返回

ModelMetadata

指定属性的元数据。Metadata for the specified property.

适用于

GetMetadataForProperty(Func<Object>, Type, String)

当在派生类中重写时,将为由属性名称指定的属性返回元数据。When overridden in a derived class, returns metadata for a property specified by a property name.

public:
 override System::Web::ModelBinding::ModelMetadata ^ GetMetadataForProperty(Func<System::Object ^> ^ modelAccessor, Type ^ containerType, System::String ^ propertyName);
public override System.Web.ModelBinding.ModelMetadata GetMetadataForProperty (Func<object> modelAccessor, Type containerType, string propertyName);
override this.GetMetadataForProperty : Func<obj> * Type * string -> System.Web.ModelBinding.ModelMetadata
Public Overrides Function GetMetadataForProperty (modelAccessor As Func(Of Object), containerType As Type, propertyName As String) As ModelMetadata

参数

modelAccessor
Func<Object>

模型访问器。The model accessor.

containerType
Type

容器的类型。The type of the container.

propertyName
String

属性的名称。The name of the property.

返回

ModelMetadata

指定属性的元数据。Metadata for the specified property.

例外

containerType 参数为 nullThe containerType parameter is null.

- 或 --or- propertyName 参数为 null 或为空。The propertyName parameter is null or empty.

- 或 --or- propertyName 类型中不能找到由 containerType 指定了名称的属性。A property that has the name specified by propertyName cannot be found in the containerType type.

适用于