我想为 Int32 制作额外的编辑器模板。在其中我想获取所有属性(自定义/默认数据注释)并使用它们做一些工作:
@model Int32
@{
string propertyName = ViewData.ModelMetadata.PropertyName;
var attributes = ViewData.ModelMetadata.GetSomeHowAllTheAttributesOfTheProperty;
SomeWorkWithAttribute(attributes);
}
<input type="text" name="@propertyName" value="@ViewData.ModelMetadata.DisplayFormatString" class="form-control"/>
那么问题来了,如何在 EditorTemplate 中获取属性的所有属性呢?
提前谢谢