2

session.CreateMultiQuery().Add(...) accepts IQuery, but IQueryOver does not appear to inherit from IQuery.

Seems strange to me that I can't user QueryOver in a multi query?

Chris Haines
  • 6,445
  • 5
  • 49
  • 62

1 Answers1

5

QueryOver uses .Future() which does the same as MultiQuery.

Florian Lim
  • 5,332
  • 2
  • 27
  • 28
  • Thanks, I had seen that but can't find any example of how to use it to execute two queries using QueryOver. Could you post an example for me? – Chris Haines Apr 05 '11 at 16:07
  • 2
    @Hainesy An example of how to use .Future() can be found in [an answer I have given before](http://stackoverflow.com/questions/5266180/fighting-cartesian-product-x-join-when-using-nhibernate-3-0-0/5285739#5285739). – Florian Lim Apr 06 '11 at 07:52
  • Hi - as far as I can tell, futures is for executing realted queries where you want NHibernate to automatically fill your object for you? In my case, this is not the case - I have essentially two unrelated queries (in terms of object heirarchy) and I want to be able to get at the results from both queries myself. Is this possible? – Chris Haines Apr 06 '11 at 08:28
  • @Hainesy Futures are not just for related queries. They can be used for related queries to avoid cartesian products but you can also have completely unrelated queries. Either way, they will be executed in one roundtrip as soon as you access the actual values (e.g. with `.ToList()`). – Florian Lim Apr 06 '11 at 08:54