O'Reilly logo

NHibernate 4.x Cookbook - Second Edition by Jason Dentler, Alexander Zaytsev, Gunnar Liljas

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

Configuring NHibernate with hibernate.cfg.xml

NHibernate offers several methods for configuration and a number of configuration settings.

In this recipe, we will show you how to configure NHibernate using the hibernate.cfg.xml configuration file, with a minimal number of settings to get your application up and running quickly. The recipe also forms the base for several other recipes in this chapter.

Getting ready

  1. Complete the steps from the Installing NHibernate recipe in this chapter.
  2. Add a console application project to your solution called ConfigByXml.
  3. Set it as the Startup project for your solution.
  4. Install NHibernate to ConfigByXml project using the NuGet Package Manager Console.
  5. In ConfigByXml, add a reference to the Eg.Core project.

How to do it... ...

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