I'm us开发者_运维百科ing EF4. I've found a very annoying issue.
I have a db view that I've dragged into my Entity Model class. When I try to iterate over the hole collection, the data displayed, it's almost the same that the first objects... I've tried enabling Lazy Loading, but nothing works.. it's a really simple snippet.. why doesn't work???
Dal.Entities context = new Dal.Entities();
list = context.vw_Full_Poll.ToList();
foreach (var item in list)
{
PrintPoll(htmlWriter, item);
}
You haven't defined a PK for the view. Since DB VIEWs don't have PKs, the EF can't derive this automatically.
精彩评论