Hey, I have this code here, he fought with it for hours. basically what this sql statement does is get ALL subfolders of a specific folder (@compositeId).
WITH auto_table (id, Name, ParentID) AS ( SELECT C.ID, C.Name, C.ParentID FROM Composite_Table AS C WHERE C.ID = @compositeId UNION ALL SELECT C.ID, C.Name, C.ParentID FROM Composite_Table AS C INNER JOIN auto_table AS a_t ON C.ParentID = a_t.ID ) SELECT * FROM auto_table
This query will return something like this:
- Id | Name | ParentId
- 1 | StartFolder | Null
- 2 | Folder2 | one
- 4 | Folder3 | one
- 5 | Folder4 | 4
Now I want to convert the code to linq. I know this is due to some form of recursion, but still stuck thanks to statement c. Help?
sch55 source share