views:

246

answers:

1

How do you map a table called category with Id as Primary Key which has self reference called ParenCategoryId using LinqToEntity?

A: 

Create a FK that points from ID to ParentCategoryID. EF should pick up the navigation property from there. The name will be useless though so you will have to do some extra work (through a code generator or T4 template) to rename it to something more suiting like "ParentCategory".

jwendl