>  First, simply fetch the employees in full:
> var q = from e in ctx.Employees select e;

Excellent description, Frans... one thing I like to point out is that
if you make your initial (flat) query from the database ordered by the
parent id and entry id, you get "in-order insertion" behavior when
building the tree, which makes everything faster:

SELECT ManagerID, EmployeeID, Name
FROM Employee
ORDER BY ISNULL(ManagerID, 0), EmployeeID

--
"Your lack of planning DOES constitute an emergency on my part... so
PLAN BETTER! "

Marc C. Brooks
http://musingmarc.blogspot.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to