开发者

Own table for an Entity Framework 4 one-to-many association

开发者 https://www.devze.com 2023-02-10 12:40 出处:网络
I\'m using the model-first approach offered by the EF4. I have two entities: User and Feature. As you would imagine, a User has a collection of Feature. After modeling this association and generating

I'm using the model-first approach offered by the EF4. I have two entities: User and Feature. As you would imagine, a User has a collection of Feature. After modeling this association and generating the SQL, the result is that the table Feature has a FK to User. What I want is to have the E开发者_如何学编程F generate another table UserFeatures to store the relationships. Is there a way to do this without modeling the UserFeatures entity?


EF will create such table only if you want to model M:N relation. There is no reason to have such table for 1:N and EF don't generate it unless you somehow model it in designer.

0

精彩评论

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