DataAnnotationsModelMetadataProvider.CreateMetadata(IEnumerable<Attribute>, Type, Func<Object>, Type, String) 方法

定义

创建指定模型的元数据。Creates metadata for a specified model.

protected:
 override System::Web::ModelBinding::ModelMetadata ^ CreateMetadata(System::Collections::Generic::IEnumerable<Attribute ^> ^ attributes, Type ^ containerType, Func<System::Object ^> ^ modelAccessor, Type ^ modelType, System::String ^ propertyName);
protected override System.Web.ModelBinding.ModelMetadata CreateMetadata (System.Collections.Generic.IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName);
override this.CreateMetadata : seq<Attribute> * Type * Func<obj> * Type * string -> System.Web.ModelBinding.ModelMetadata
Protected Overrides Function CreateMetadata (attributes As IEnumerable(Of Attribute), containerType As Type, modelAccessor As Func(Of Object), modelType As Type, propertyName As String) As ModelMetadata

参数

attributes
IEnumerable<Attribute>

属性。The attributes.

containerType
Type

如果没有容器,则为容器的类型或 nullThe type of the container, or null if there is no container.

modelAccessor
Func<Object>

模型访问器。The model accessor.

modelType
Type

模型的类型。The type of the model.

propertyName
String

属性的名称;如果该模型不是属性,则为 nullThe name of the property, or null if the model is not a property.

返回

ModelMetadata

模型的元数据。Metadata for a model.

适用于