Anybody know of a way to batch NHibernate queries using NHibernate.Linq like you can do with MultiCriteria and ICriteria objects?
With MultiCriteria I can create something like this:
var crit = session.CreateMultiCriteria()
.Add(session.CreateCriteria(typeof(Entity1)).Add(Restrictions.Eq("Property1","Value"))
.Add(session.CreateCriteria(typeof(Entity2)).Add(Restrictions.Eq("Property2","Value2"));
var result = crit.List();
var list1 = (IList)result[0];
var list2 = (IList)result[1];
It would be nice if I replace the CreateCriteria calls with Linq calls and get something like this:
var crit = session.CreateMultiCriteria()
.Add(session.Linq<Entity1>().Where(x => x.Property1 == "Value1")
.Add(session.Linq<Entity2>().Where(x => x.Property2 == "Value2");
var result = crit.List();
var list1 = (IList<Entity1>)result[0];
var list2 = (IList<Entity2>)result[1];
We're using the Linq API for most of our other queries and it would be nice to use the same Linq syntax when we need to run MultiCriteria queries as well.
Thanks.