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 – Configuring NHibernate in code

In this exercise, we are going to implement a simple application using NHibernate which fully configures the ORM framework in code.

  1. Open SQL Server Management Studio (SSMS) and create a new database called CodeConfigurationSample.
  2. Open Visual Studio and create a new project. Select Console Application as the project template. Call the project CodeConfigurationSample.
  3. Add a reference to the two assemblies NHibernate.dll and NHibernate.ByteCode.Castle.dll to the project.
  4. In the Solution Explorer, right-click on the solution and select Add | New Folder and name the folder Schema.
  5. Right-click on the Schema solution folder and select Add | Existing Item. Add the two files, nhibernate-configuration.xsd and ...

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