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
- Complete the steps from the Installing NHibernate recipe in this chapter.
- Add a console application project to your solution called
ConfigByXml
. - Set it as the Startup project for your solution.
- Install NHibernate to
ConfigByXml
project using the NuGet Package Manager Console. - In
ConfigByXml
, add a reference to theEg.Core
project.
How to do it... ...
Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.