I have a self referencing table named categories that has a parentcategoryid column that is nullable.
When I added the table to the entity designer it created two navigation properties for this relationship and I named one ParentCategory (the zero or 1 nav prop) and the other I named SubCategories (the * many nav prop).
Everything works great except when I go more than one level deep it doesn’t pick up the deeper levels.
So I get all the Category.SubCategories but I don’t get the categories under the subcategories.
Am I missing something? starting to think I should have stuck with NHibernate. Shouldn’t the deeper levels get lazy loaded?
return from c in _entities.ContentCategorySet.Include("SubCategories")
where c.ParentCategory == null
orderby c.Importance, c.Title
select c;
That’s how I would Imagine the SubCategories property to behave.
Level 1
++ Level 2
++ Level 2
++ ++ Level 3
Where SubCategories property of Level 1 only returns Level 2 items. Then to get to Level 3 you would access the consecutive Level 2 items, in a recursive method.