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 handled by sending query specifications to the repository.
A DAO is simply an abstraction of an application's data access. Its purpose is to hide the implementation details of the database access from the consuming code.
The first recipe shows the beginning of a typical data access object. The remaining recipes show how to set up a repository-based data access layer with NHibernate's various APIs.