O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing multiple queries in a batch

Up to now, each query we executed caused a round trip to the database server. Sometimes, we know that we need to execute multiple queries to, for example, populate a complex screen of our application with data. In this scenario, we can improve the performance of our application significantly if we send all queries as a batch to the database. The database, in turn, will send us a list of query result sets instead of a single result set.

The LINQ to NHibernate provider defines a ToFuture extension method just for this purpose. All queries that are terminated with ToFuture are sent to the database as a batch at the moment when the data of the first query is accessed. Let's assume that our application is an ordering ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required