O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Using QueryOver to retrieve data

In this example, we want to add some products to the database and use the QueryOver method to retrieve a special selection of these products.

We want to use the Loquacious configuration and ConfOrm mapping in this example to refresh our memory a bit.

  1. Open SQL Server Management Studio and log in to your local SQL Server Express edition.
  2. Create a new database called QueryOverSample.
  3. Open Visual Studio and create a new project. Use the Console Application template and name the project QueryOverSample.
  4. Add references to the NHibernate.dll, NHibernate.ByteCode.Castle.dll, and ConfOrm.dll assemblies, located in the lib folder of the project.
  5. Add a new class to the project. Name it Category.cs.
  6. Add the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required