Categories
.net entity-framework linq linq-to-entities sql

Retrieve all Children and their Children, recursive SQL

Consider the following rows in a database:

Id      |   Parent
__________________
1 null
2 1
3 2
4 3
5 null
6 5

Each Id that has a null Parent is the “Owner”/”Super Parent”.

What would be the best approach, performance wise, to collect the parents and their children ? Should I use LINQ or Stored Procedures ?

I want the end result to be IEnumerable<IEnumerable<int>>.