I'd say you need to use document query, let say you have couple page types and you want to get subsection of the document tree (here is the pic):
public class KenticoDocument
{
public int NodeId { get; set; }
public int NodeParentId { get; set; }
}
public class Event : KenticoDocument
{
public string EventTitle { get; set; }
public List<Meeting> MeetingList { get; set; }
}
public class Meeting : KenticoDocument
{
public string MeetingTitle { get; set; }
}
Get your subtree as List (i.e. list of DataRow form DB)
var section = DocumentHelper.GetDocuments()
.Types(new string[] { "CMS.MenuItem", "CMS.BookingEvent" })
.Path("/Community/Events/", PathTypeEnum.Section)
.OnSite("CorporateSite")
.Culture("en-us")
.Result.Tables[0].AsEnumerable().ToList();
and build your hierachy
var hierarchy = section.Where(s => s.Field<string>("ClassName") == "CMS.MenuItem")
.Select(x =>
new Event
{
EventTitle = x.Field<string>("DocumentName"),
NodeId = x.Field<int>("NodeID"),
NodeParentId = 0,
MeetingList = section
.Where(s => s.Field<string>("ClassName") == "CMS.BookingEvent" && s.Field<int>("NodeParentID") == x.Field<int>("NodeID"))
.Select(
m => new Meeting
{
MeetingTitle = m.Field<string>("DocumentName"),
NodeId = x.Field<int>("NodeID"),
NodeParentId = x.Field<int>("NodeParentID"),
})
.ToList()
});