<分区>
我使用现有数据库在 Entity Framework 中生成了数据模型,并填写了表格。
我正在尝试访问表中的数据并在 WPF 中填充数据网格,但一直收到空引用异常。
这里产生异常:
pubilc List<item> GetAllItems()
{
using (var context = new DbEntities())
{
if (context.items != null)
return context.items.ToList() //exception generated here
else
return new List<item>();
}
}