Chapter 7. Data Access Layer

In this chapter, we will cover the following topics:

  • Transaction auto-wrapping for the data access layer
  • Setting up an NHibernate repository
  • Using named queries in the data access layer
  • Using ICriteria in the data access layer
  • Using paged queries in the data access layer
  • Using LINQ specifications in the data access layer

Introduction

There are two types of data access layers that are common in today's applications: Repositories and Data Access Objects (DAO). In reality, the distinction between these two has become quite blurred; however, in theory, it's as follows:

  • A repository should act like an in-memory collection. Entities are added to and removed from the collection and its contents can be enumerated. Queries are typically ...

Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.