Stumped on this one. I have a many to many self referencing relationship(FluentNH) mapped for a given class:
public class Folder
{
public IList<Folder> ParentFolders{get;set;}
}
I'm looking to create a query that pulls root folders(ie folders that have ParentFolders.Count() == 0). The self reference is done via lookup table, so ParentFolderID is not actually accessible from the class(only shows up in the mapping).
public IList<Folder> GetRootFolders()
{
return session.CreateCriteria<Folder>()
.outofideas()
.List<Folder>();
}
Any assistance or thoughts on a self referencing hierarchy via lookup table are greatly appreciated. The tables themselves are legacy and as such, unable to be modified.