I have the following tree in WPF:
Product
-> Feature
-> Subfeature
-> Test Case
Each type is different, but they all have a Children and Parent
property for navigating the tree.
When using the WPF TreeView, if you expand one level, it will check
the count of the "Children" property of every child that you
expanded. So if I expanded product it would do something like this
(in the background):
foreach (Feature f in product.Children)
showPlus = f.Children.Count;
Thus, this creates a select N+1 issue.
If I were handwriting the SQL, when product was expanded, I would load
all of the Subfeatures with this query:
select Subfeature.*
from Product, Feature, Subfeature
where Product.Id = @JustExpandedId
and Subfeature.ParentId = Feature.Id
and Feature.ParentId = Product.Id
I can't seem to find a way to make it preload all of the children of a
children collection. Making the collection not lazy load does not
seem to fix the problem. What is the best way to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---