SolarX
SolarX

Reputation: 1943

Entity Framework 4: Self referencing entities, parent/child

we are using a model first design.

When I create a self referencing parent child association on an entity the designer always marks one end "many", which would be the "children" and is ok like that. But the designer makes the other end "1 (One)", which is not ok since a parent is not required. If I change it to "0..1 (Zero or One)" the designer changes the other end from "* Many" to "0..1 (Zero or One)". So both ends are "0..1 (Zero or One)". This is driving me crazy :(

What am I doing wrong?

Upvotes: 4

Views: 1050

Answers (1)

Meff
Meff

Reputation: 5999

Is the 'ParentKey' column marked as nullable (Both in DB & EDMX)? Could prevent the relationship type you are after from being set up.

Upvotes: 1

Related Questions