Lets say that I have a series of objects that form an aggregate.
public class C{
public string Details {get;set;}
}
public class B{
public string Details {get;set;}
public List<C> Items {get;set;}
}
public class A{
public long ID {get;set;}
public string Details {get;set;}
public List<B> Items {get;set;}
}
using Dapper, what is the best way to populate these from tables in a database (in my case it's postgres but that shouldn't matter). The tables in the example are pretty much one for one with the object model. The Items property on the class representing foreign key relationships to each subordinate object. i.e. 3 tables, A has a One to Many relationship with B, B has a One to Many relationship with C.
So for a given ID of A I want my objects to have all their child data as well.
My best guess is that I should use QueryMultiple somehow but I am not sure how best to do it.