Code First adding to collections? How to use Code First with repositories?

前端 未结 6 1340
执笔经年
执笔经年 2020-12-17 14:58

EDIT: This happen only on larger scale projects with repositories. Is there anybody using EF4 with CodeFirst approach and using repositories? Please advise me.

Hi. I

6条回答
  •  孤城傲影
    2020-12-17 15:58

    The issue mentioned above by Dejan.S regarding the use of 'List' to initialize a collection still occurs in EF5 RTM and ASP.NET 4.5 RTM:

    List init issue

    BUT, if you remove the virtual keyword from the primary key (e.g. UserId in the above screencap), it works! So it seems all of your properties can be virtual, EXCEPT the primary key.

提交回复
热议问题