This question refers to http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx
Suppose I have a table that looks like this:

(source: matthidinger.com )
And I have a recursive data structure that looks like this:
public class TreeNode
{
public TreeNode(){}
public string NodeId { get; set; }
public string ParentId { get; set; }
public string Name { get; set; }
public IEnumerable<TreeNode> Children { get; }
}
How do I populate this recursive data structure from a table using Linq?
: , , , ; , CTE. , Linq, Linq SQL DataContext . , , , ForEach ; .
.