【发布时间】:2016-07-12 16:58:51
【问题描述】:
如果我的属性不存在,实体框架是否可能无法映射它? 现在我有一个 ID,Name,Surname,Type, table 但我没有属性 Email 。 EF 正在映射 ProjectUser 对象属性,该对象具有不在数据库中的属性。总之,如果对象不是数据库,我想维护对象的 Email 属性,但如果有,我想获取值。
namespace Project.IdentityModel.Models {
public class ProjectUser: IUser<string> {
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }//This property no yet into DB.
public string Surname { get; set; }
public string Type { get; set; }
}
【问题讨论】:
-
It is possible with entity framework that cannot map my property if it does not exist?什么?您的问题很难解释,但如果您不想映射属性,请添加[NotMapped]属性。
标签: c# asp.net-mvc entity-framework