nHibernate: Query tree nodes where self or ancestor matches condition
- by Famous Nerd
I have see a lot of competing theories about hierarchical queries in fluent-nHibernate or even basic nHibernate and how they're a difficult beast.
Does anyone have any knowledge of good resources on the subject. I find myself needing to do queries similar to: (using a file system analog)
select folderObjects from folders where folder.Permissions includes :myPermissionLevel or [any of my ancestors] includes :myPermissionLevel
This is a one to many tree, no node has multiple parents.
I'm not sure how to describe this in nHibernate specific terms or, even sql-terms. I've seen the phrase "nested sets" mentioned, is this applicable? I'm not sure.
Can anyone offer any advice on approaches to writing this sort of nHibernate query?