-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
NHibernate 4.x Cookbook - Second Edition
By :
Named queries encapsulated in query objects are a powerful combination. In this recipe, we will show you how to use named queries with your data access layer.
To complete this recipe, you will need the common service locator from Microsoft patterns and practices. The documentation and source code can be found at http://commonservicelocator.codeplex.com.
Complete the previous recipe: Setting up an NHibernate repository.
Following Fast testing with SQLite in-memory database recipe in Chapter 6, Testing, create a new NHibernate test project named Eg.Core.Data.Impl.Test.
Include the Eg.Core.Data.Impl assembly as an additional mapping assembly in your test project's App.Config with the following xml:
<mapping assembly="Eg.Core.Data.Impl"/>
In the Eg.Core.Data project, add a folder for the Queries namespace.
Add the following IQuery interfaces:
public interface IQuery
{
}
public interface IQuery<TResult> : IQuery
{
...