Chapter 9. Advanced Data Access Patterns
We are coming to the end of our NHibernate learning experience. This is not the last chapter but the chapters after this are a bit disconnected from our journey so far. Previous chapters should have given you solid understanding of how to use NHibernate in a real-life application. We learned an important design pattern such as repository and other useful design principles. But we closed the chapter saying repository pattern has some downsides. In this chapter, we would dig deeper into that statement and try to understand what those downsides are and what can be done about them. In our attempt to address the downsides of repository, we would present two data access patterns, namely specification pattern and query object pattern. Specification pattern is a pattern adopted into data access layer from a general purpose pattern used for effectively filtering in-memory data. Query object pattern on the other hand, is a very specific pattern developed around...