DataAnnotationsModelMetadataProvider.CreateMetadata 方法

定義

為指定模型建立元資料。

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>

屬性。

containerType
Type

容器的種類,或 null 是否沒有容器。

modelAccessor
Func<Object>

模型配件。

modelType
Type

型號的類型。

propertyName
String

物件名稱,或 null 是模型是否為物件。

傳回

模型的元資料。

適用於