Configuring NHibernate with Fluent NHibernate
The third-party Fluent NHibernate library has its own syntax to configure NHibernate. In this recipe, we'll show you how to configure NHibernate using this syntax.
Getting ready
- Complete the steps in Installing NHibernate recipe.
- Add a console application project to your solution called
ConfigByFNH
. - Set it as the Startup project for your solution.
- Install NHibernate to the
ConfigByFNH
project using NuGet Package Manager Console. - Install the package
FluentNHibernate
toConfigByFNH
project using NuGet Package Manager Console. - In
ConfigByFNH
, add a reference to theEg.Core
project.
How to do it…
- Add an
App.config
file with this configuration:<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> ...
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.