Hey I have following class:
public class Tree
{
public int Id { get; set; }
public Tree Parent { get; set; }
public ICollection Chidren { get; set; }
}
I want to get all of related entities.
My tree structure looks like below:
- Root (id 1)
-- Cat1 (id 2)
--SubCat 1 (id 4)
--SubCat 2 (id 5)
-- Cat2 (id 3)
If I try to get all entities using:
_context.Entity.FirstOrDefault(x => x.Id == 1)
.Include(x => x.Children)
it gaves me Root, cat1 and cat2 (as children), but Cat1 and Cat2 childrens are missing. Is it possible to get ALL related entities, starting from root entity, and ending at "children of children"?