I need to get recursively all descendants of some node. For example for node with Id=1 I need to get following descendants: 2,3,4,5,6. For node with Id=2 I need to get nodes:4,5,7. How I can to do this win Linq-To-Entites with minimum requests to server?
| Id | ParentId | Name |
------------------------
| 1 | 1 | a |
------------------------
| 2 | 1 | b |
------------------------
| 3 | 1 | c |
------------------------
| 4 | 2 | d |
------------------------
| 5 | 2 | e |
------------------------
| 6 | 3 | f |
------------------------
| 7 | 5 | g |
The only way to execute it by single request is to use ExecuteQuery for stored function in SQL database. While this stored function will use Common Table Expression for recursive query.
Please mark this as Answer if it resolve the issue.