How will you make it if you never even try?

April 1, 2009

NHibernate and FluentNHibernate Rock!

Filed under: C# — Tags: , — charlieflowers @ 9:18 pm

Saw a very interesting presentation last night by Brendan Erwin, on how he uses NHibernate and FluentNHibernate. FluentNHibernate is a tool that lets you specify your mappings between the database and your domain objects in C# code, instead of in XML. This is awesome for several reasons:

  1. You can refactor common bits of mappings into helper methods, thus keeping your mappings more DRY.
  2. It is much more refactoring friendly. It uses lambda expressions and is able to avoid strings for property names. Thus if you rename a property using .NET refactoring or Resharper, the update applies everywhere.
  3. You get intellisense as you create and edit mappings. You’d be surprised how greatly this improves the process.

Blog at