I use nhibernate and I want to load a branch of the tree. My tree is not binary, nor doubley linked. Trust me this is bad really bad, you have a couple of options.
- Load your whole graph or tree
- Make lazy loaded calls one at a time to your tree, or some variation there fore of.
- Load your levels.
If you chose option one you probably work for a hardware manfacturer, or don’t have an example, option 2 works if again you batch and have small tree.
Option 3 is the only real solution, and basically you will want to make sure your parent / parent id is loaded and not lazy loaded so you can trigger the next query.
Ex.
Dim myBranch as New List(Of Object)Dim myTree as New List(Of List(Of Object))
Dim myCurrentParentId as Object
'Loop StartmyCurrentParentId = myChildObj.ParentId
myBranch.Add(myChildObj.Id)myTree.Add(NhibernateQuery.List())'This query should be like "FROM Domain.Tree t WHERE t.ParentId =
arentId
'Loop End
You can then use the branch list to find selected children for displaying levels of tree, or a branch of a tree.












