INode Interface and ToTree Methods - lobodava/artisan-orm GitHub Wiki
Artisan.Orm contains the following INode interface:
public interface INode<T> where T: class
{
Int32 Id { get; set; }
Int32? ParentId { get; set; }
IList<T> Children { get; set; }
}
If an object implements this interface then the following extension methods become available on all three levels of datareading:
base.ReadToTree()
base.ReadToTreeList()
cmd.ReadToTree()
cmd.ReadToTreeList()
dr.ReadToTree()
dr.ReadToTreeList()
List<INode<T>>.ToTree()
List<INode<T>>.ToTreeList()
Read more about hierarchical sorting and combination of Id-ParentId and HierarchyId approaches to hierarchical data in this article.