【发布时间】:2011-04-16 21:20:01
【问题描述】:
我在 EF 中有一个名为 Profile 的实体,我想将数据注释属性添加到该实体的 FirstName 属性中。所以,我像这样创建了一个新的部分类;
public partial class Profile : EntityObject
{
[Required]
[Display(Name = "First Name")]
[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
[DataMemberAttribute()]
override public global::System.String FirstName
{
get
{
return _FirstName;
}
set
{
OnFirstNameChanging(value);
ReportPropertyChanging("FirstName");
_FirstName = StructuralObject.SetValidValue(value, false);
ReportPropertyChanged("FirstName");
OnFirstNameChanged();
}
}
}
但我得到了这个;
“
CC.Models.Profile”类型已经包含“FirstName”的定义
有什么想法吗?
问候,
瑞恩
【问题讨论】:
标签: c# entity-framework asp.net-mvc-3 overriding