views:

797

answers:

0

I have an entity that exposes a collection of children of the same type. The entity can itself be a child of another instance - in effect a many-to-many relationship with itself. In the database I have a linker table with two columns - parentId and childId - both of which reference the Id column in my entity table. Entity Framework correctly recognises that it is a many-tomany relationship with itself but throws an error:

Problem in Mapping Fragments starting at lines 249, 300: Two entities with possibly different keys are mapped to the same row. Ensure these two mapping fragments map both ends of the AssociationSet to the corresponding columns

Any ideas how I can accomplish this?