Entity Framework - How do create an association to/from the same entity?
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).
精彩评论