我正在为脚手架写t4文件。
在Controller.cs.t4中 我要从元数据中获取属性
我写了这个
<# foreach(var property in ModelMetadata.Properties) { #>
<# if(MyName == null) { continue; } #>
ModelState.AddModelError(<#= ModelVariable #>.<#= property.PropertyName #>, new NotImplementedException());
<# } #>
public class ViewModel {
[Display(Name="MyName")]
public string Name { get; set; }
}
但是我不能接受属性。