Friday, July 18, 2014

Entity Framework Query Batching

I’ve been an NHibernate fan for a long time, but on my recent projects I’m making the switch to Entity Framework.

Although I like the overall experience, there are still lot of features missing.

One of the things I liked about NHibernate was the support for query batching using the NHibernate Future<> syntax.

This allowed you to write multiple simpler queries instead of writing one complex one. The moment you try to read one query result, all batched queries are sent in 1 command(!) to the database and the results are returned.

Although a similar feature does not exist in Entity Framework out-of-the-box, you can use the EntityFramework.Extended library to get this functionality. This library extends the functionality of Entity Framework with the following features:

In this case I’m looking at the Future Queries feature:

No comments: