Hi folks,
I'm used to loading some children results (for a parent result) using the LoadWith
syntax. Works great. Is there a way I can limit these LoadWith results to the most recent 5 or something?
I've got some pseduo code with some inline comments to help explain what I'm trying to do...
Eg.
IList<Parent> results;
using (DataBaseContext db = new MyDb())
{
var dlo = new DataLoadOptions();
dlo.LoadWith<Parent>(x => x.Child1); // We only want the most recent 10.
dlo.LoadWith<Parent>(x => x.Child2); // All of these...
dlo.LoadWith<Parent>(x => x.Child3); // Only the most recent 1.
db.LoadOptions = dlo;
results = (from p in Parent
orderby p.Id descending
select p).Take(5).ToList();
}
Cheers :)