问题描述
How to achieve Oraclel's CONNECT BY PRIOR output using LINQ? Basically i need the hierarchy and level using LINQ?
推荐答案
There isn't one. LINQ does not have special support for recursive queries.
An approach you can use is to write a method that fetches the top level using a LINQ query, then a method that calls itself recursively to get the children for each of the items received so far. This can result in a lot of small LINQ queries which might not be desiarable.
A different approach is to use a stored procedure containing a recursive query and call that using LINQ.