Say I have the following documents in RavenDb:
public class TopLevel
{
public string Id { get; set; }
public string Name { get; set; }
}
public class NextLevel
{
public string Id { get; set; }
public string TopLevelId { get; set; }
public string Name { get; set; }
}
public class Leaf
{
public string Id { get; set; }
public string NextLevelId { get; set; }
public string Name { get; set; }
}
And the following viewmodels:
public class TopLevelViewModel
{
public string Id { get; set; }
public string Name { get; set; }
public List<NextLeveViewModell> NextLevels { get; set; }
}
public class NextLevelViewModel
{
public string Id { get; set; }
public string TopLevelId { get; set; }
public string Name { get; set; }
public List<LeafViewModel> Leaves { get; set; }
}
public class LeafViewModel
{
public string Id { get; set; }
public string NextLevelId { get; set; }
public string Name { get; set; }
}
What would be the best way of constructing that view model without making loads of trips to the db and manually collecting / constructing the structure?
Could I use multi-map for this?
Might be a dumb question but I've not used RavenDb in a while! Been doing Android / iPhone dev so a little rusty!