开发者

Entity Framework - How do create an association to/from the same entity?

开发者 https://www.devze.com 2022-12-28 11:39 出处:网络
In Entity Framework (VS2010) how do I create an association to/from the same table?(a many-to-many is what I want)

In Entity Framework (VS2010) how do I create an association to/from the same table? (a many-to-many is what I want)

Background - I was expecting under the bonnet a NODE and RELATIONSHIP table, where the latter has a parent_node_id and a child_node_id (i.e. pointing back to the NODE id column). I can't seem to get th开发者_Python百科e designer to add it...


Model first: create entity, right click: add association, select same Entity, mark it Many to many on both ends.

Database first: create two tables: Node and Edge, Edge contains two Node references. (Using appropriate PK, FK's).

0

精彩评论

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

关注公众号