I have used the accepted answer to the question Hierarchical data in Linq - options and performance successfully to query a hierarchical table for all descendants of a particular record/node. Now I need to find the root of the tree that a particular node is a descendant of. How can I use as close a possible solution as that accepted answer to do this?
The hierarchy is represented by a self-referencing table with a ParentId column, which is null for the top item in the hierarchy.