开发者

Entity Framework - Missing column(s)?

Model Image http://screencast.com/t/ODkwZDQx http://screencast.com/t/ODkwZDQx

I have a simple 3 table model built from my DB. Company has 0 or more ProductsSold. Company has 0 or 1 AutoNegotiationDetails. As you see from the diagram, this is what is modeled. However, in the ProductsSold Mapping Details you can see that the CompanyId Value/Property is missing. Nor can I add it. I have discovered that I can get to it programat开发者_StackOverflow中文版ically by going to ProductsSold.Company.CompanyId.

1) Is this correct? 2) Why does EF hide the FK field?


Originally Entity Framework did not support foreign keys or hid them. In a podcast with Julia Lerman, she mentions foreign keys were not included to avoid the scenario of multiple joins to get data. Also in the blog post it mentions "people say FKs pollute the conceptual model". Since this was such a divided subject the Entity Framework team has decide to add foreign key support in VS 2010 Beta.

In .Net 4 they have added FK Associations. You can read about them on the EF blog.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜