我有一个RadGridView
这样填充的:
public MainWindow()
{
InitializeComponent();
Occupations = _dbContext.Occupations.ToList();
DataGrid.ItemsSource = Occupations;
}
Occupation
实体类看起来像这样(为简洁起见,删除了属性):
public partial class Occupation : XTimeEntity
{
public Occupation()
{
this.BUSCOMPLs = new List<BUSCOMPL>();
this.EMPLOYEEs = new List<EMPLOYEE>();
}
public short OccupationCodeId { get; set; }
public short SiteCodeId { get; set; }
public short OccupationActive { get; set; }
public string OccupationName { get; set; }
public virtual ICollection<BUSCOMPL> BUSCOMPLs { get; set; }
public virtual ICollection<EMPLOYEE> EMPLOYEEs { get; set; }
}
当代码运行时,在最后一行MainWindow
我得到错误(SqlException
):
无效的对象名称“dbo.OccupationBUSCOMPL”
无效的对象名称“dbo.OccupationEMPLOYEE”
RadGridView
当然,这些集合应该与?的列创建无关。它应该只包括OccupationCodeId
through OccupationName
。我从未在其他网格上发现此问题。什么可能导致这种情况?