You can use: var f1 = session.CreateCriteria<YourType>().Add(Restrictions.IdEq(key1)).FutureValue<YourType>() ... var fn = session.CreateCriteria<YourType>().Add(Restrictions.IdEq(keyn)).FutureValue<YourType>()
...and the queries will be executed together when you access fn.Value. You could create a function that receives IEnumerable<TKey> and returns IEnumerable<T>, creating FutureValues for every key. Yes, it's different from Session.Get (here<http://ayende.com/Blog/archive/2009/04/30/nhibernate-ndash-the-difference-between-get-load-and-querying-by.aspx>), but you could still use the *query* cache (if you're repeating these queries, that is). It all depends on your actual usage. Diego On Mon, Nov 16, 2009 at 12:41, Jonathan <[email protected]>wrote: > Session.Get is great but why isn't there a way to pass in multiple > primary keys? I can't imagine this would be a complicated addition > and it would be extremely useful in eliminating round trips to the > database. Right now I have to get by example but then I don't hit the > cache. > > -- > > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=. > > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=.
