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