Skip to main content

Working with NHibernate 3.0

Working with NHibernate 3.0

Benjamin Perkins

ISBN: 978-1-118-11257-1

Aug 2011

230 pages

Select type: Paperback

Product not available for purchase


This book provides examples using the IQuery, ICriteria, QueryOver, and LINQ to NHibernate API’s within the context of an example Guitar Store inventory program.  The reader is walked through the creation of a Microsoft SQL Server 2008 database, the creation of a Visual Studio 2010 solution consisting of 3 projects (a Window Presentation Foundation (WPF), a Console Application, and a Class Library). Each one utilizes the .NET 4.0 framework.  Then the reader is walked through the steps required to configure and use the many features available contained within NHibernate 3.2.  Further instructions and examples exist for the insertion of parent/child relationships, Session management, entity states (transient, persistent and detached), deletion, caching, and batching. 

The last chapter utilizes ASP.NET MVC 3 and jqGrid for the creation of an internet program for viewing the guitar inventory using NHibernate and the session per web request model.

Table of Contents

Chapter 1: Getting Started With Nhibernate 3 1

Chapter 2: Using Hql 53

Chapter 3: Using Icriteria 91

Chapter 4: Using Linq to Nhibernate 145

Chapter 5: Managing State and Saving Data 169

Chapter 6: Using Nhibernate with an Asp.Net Mvc 3 Application 203

Complete code for Working with NHibernate 3
Sample SQL Database
SQL to create tables and populate them with data
ChapterPageDetailsDatePrint Run
13Error in Text
The final 3 lines on page 13 should read:

Installing the NHibernate XML schema template requires Visual Studio Professional or higher. The Schemas menu item is found within the XML menu which is accessible when you have an XML file open. Selecting Schemas opens the XML Schemas window shown in Figure 1-12.

14Error in Text
Near the bottom of the page, sentence reads:
"To create a mapping file, right-click on the Common directory...."

Should read:
"To create a mapping file, right-click on the Mapping directory...."