DataAnnotations缺少属性

时间:2013-09-19 15:02:32

标签: c# asp.net-mvc-4 .net-4.5 data-annotations

我在文件顶部有using System.ComponentModel.DataAnnotations;,但基本上我拥有的唯一属性是[DisplayName][Readonly]。即使[Display(Name...]也不存在。我错过了什么?

2 个答案:

答案 0 :(得分:0)

Resharper等工具可让您分析代码文件中的using语句。

如果您发现不需要using声明,请将其删除。

答案 1 :(得分:0)

使用以下命名空间:

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;