开发者

EF4 - Foreach local variable with static data

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜