Chapter 6. Improving Complex Query Scenarios

In this chapter, we will cover:

  • Improving dynamic sorting
  • Grouping at runtime without Lambas
  • Handling explicit loading
  • Improving complex where clauses
  • Implementing the specification pattern


When we leverage Entity Framework, we gain a huge amount of flexibility and power. This power and flexibility make it easy to get data into and out of simple to moderately complex database structures in many ways. We can get a very nice API for simple queries. However, when our business problems get more complex, we need different patterns to handle this increasing complexity. These patterns range from minor adjustments to how we leverage code, to major refactoring of the data access layer. We will walk through ...

Get Entity Framework 4.1: Expert's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.