我在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();
}
}
}
但我得到这个;
The type 'CC.Models.Profile' already contains a definition for 'FirstName'
任何想法?
问候,
瑞安
我试过这一个,但这是行不通的。 – 2017-07-25 10:28:02