Is there a way to set the fetchmode to eager for more than one object using linq for nhibernate. There seems to be an expand method which only allows me to set one object. However I need to set it for more than one object. Is this possible? Thanks
The new Linq provider does it a little differently:
var customers = session.Query<Customer>().Fetch(c => c.Orders).ToList();
More here: http://mikehadlow.blogspot.com/2010/08/nhibernate-linq-eager-fetching.html
just use it more then once.
IList<Entity> GetDataFromDatabase() { var query = session.Linq<Entity>(); query.Expand("Property1"); query.Expand("Property2"); return query.ToList(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With