I am trying to optimize some code here and even to make it better, because at the moment I just reach the 8ΒΊ level of child in my entity framework property tree.
I am doing the following:
var categories = CategoryRepository.Query(cat => cat.CategoryParent == null).
Include(firstLevel => firstLevel.CategoryChilds.
Select(secondLevel => secondLevel.CategoryChilds.
Select(thirdLevel => thirdLevel.CategoryChilds.
Select(forthLevel => forthLevel.CategoryChilds.
Select(fifthLevel => fifthLevel.CategoryChilds.
Select(sixthLevel => sixthLevel.CategoryChilds.
Select(seventhLevel => seventhLevel.CategoryChilds))))))).Select().ToList();
As you might know, this is ULTRA KILL! And besides that, I am just reaching a specific level of child tree, I want to go deeper, till I don't find more childs, is that possible using some recursion?
Thank you very much! Have a great day!