Currently I'm writing strategies for various purposes.
Like this one:
namespace x.Persistence{
using Domain;
using NHibernate.Linq;
public class ApplicationDefaultEagerLoading
:IEagerLoadingStrategy<Application>{
public virtual INHibernateQueryable<Application>
Attach(INHibernateQueryable<Application> q){
q.Expand(x=>x.Project);
q.Expand(x=>x.Statuses);
q.Expand(x=>x.Verifications);
q.Expand(x=>x.PaperVersionDetails);
q.Expand(x=>x.Call);
return q;
}
}
}
And then use them:
var q=Session.Linq<Application>();
q=new ApplicationDefaultEagerLoading().Attach(c);
return q;
As far as i see - I'm not able to write one eager loading settings that would fit all cases per aggregate root. Client needs to see data in various projections. Often data comes from multiple roots.
So I'm wondering - how others are managing this problem?