0
您好我有类实体框架中像这样: -实体框架无效列名称错误
public partial class JLLContact : DomainEntity, IUniqueId
{
// Simple Props
public int? Record1ObjectTypeCode { get; set; }
public int? Record2ObjectTypeCode { get; set; }
public DateTime? CreatedOn { get; set; }
public string Email { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
public int JLLContactId { get; set; }
public DateTime? ModifiedOn { get; set; }
public string Name { get; set; }
public string Title { get; set; }
public int? RoleLid { get; set; }
public int? BusinessLineLId { get; set; }
public int? RegionLId { get; set; }
public int? RelationScoreLId { get; set; }
public int? RelationStrengthLId { get; set; }
public int? Record1LId { get; set; }
public int? Record2LId { get; set; }
public bool? IsPrimary { get; set; }
public int? CountryLid { get; set; }
// UniqueId
public string __Id
{
get { return JLLContactId.ToString(); }
}
// Parents
public virtual ListItem Role { get; set; }
public virtual ListItem Region { get; set; }
public virtual ListItem Country { get; set; }
public virtual ListItem BusinessLine { get; set; }
}
当我尝试添加此类型数据库的条目,我得到一个错误。无效的列名称为“BusinessLine_ListItemId”,“Country_ListItemId”,“Region_ListItemId”。 显然他们指的是父母的财产。但我不明白这个问题。任何人都可以指向正确的方向。
这是Code First模型吗?我们能否看到ListItem实体和配置(如果有的话)? –
@IvanStoev - 你是对的。答案在于映射文件。我在下面进行了更改并进行了更改。 – SaiBand