How to achieve Oraclel's CONNECT BY PRIOR output using LINQ? Basically i need the hierarchy and level using LINQ?
A:
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.
Mark Byers
2010-09-27 06:30:47
thanx for the suggestion and let me try
Kishore Kumar
2010-09-27 06:39:15
A:
You could use ToLookup to create a lookup by parent id of all its children and then use the lookup in another Linq query
vc 74
2010-09-27 07:21:26