Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,550

filter by tags archive

On Fluent NHibernate

time to read 2 min | 251 words

I noticed some jokes in twitters going around, people saying stuff like “Using Fluent NHibernate, better not let @ayende find out about it”.

I think that I better clarify a few things in this regard. When FNH initially came out, what I really wanted was auto mapping, and it didn’t have that at the time (almost two years ago), but it does now. I also have some disagreement with the API choices (specifically, the decision to rename things from the NH mapping names).

But I am generally grouchy about code (whatever I wrote it or not), so that isn’t unusual. I have used FNH in the past in a few of my projects, but it always came to a point where I needed more from NHibernate and FNH was limiting to me. Please note, I am explicitly referring to myself here, not the general public. I have been working with NHibernate for over 6 years now, and working with NHibernate at NHibernate’s level is place that I am most conformable.

That isn’t the case for a wide variety of other users. Today I had an interesting experience, of guiding a customer from no application to a full blown app using FNH. The entire process (with someone to whom it was the first introduction to NHibernate) took less than an hour, was remarkably pleasant and was focused on exactly the right things.

The Fluent NHibernate team has managed to create a truly remarkable project, well done.


Ajai Shankar

"..and working with NHibernate at NHibernate’s level is place that I am most conformable"

Did you mean ConfORM-able? :-)


James Gregory

Thank you for the kind words Oren. It's nice to hear you've had some pleasant experiences with FNH, and even better that new comers to NH find it useful.

We've always aimed at making the experience a bit nicer for beginners and people who don't utilise the full features of NH (let's face it, that's quite a few people); as such, devs like yourself were never really going to find much use in it (outside of spikes and such, maybe).

Basically, you've described your experiences of FNH to be exactly what I was hoping for, which is great.


Tom Janssens

A small success story: I have been using FNH for quite some time now, and I even wrapped it with another framework, which makes setup even easier. (I.e. a single interface which simply points to your domain classes, as well as a plugin system - for example A full text search, support for custom usertypes, ...)

The reason for this is that most sme's I'm writinig software for do not have the knowledge in-house on (F)NH...

Nevertheless, it would have been nearly impossible to implemet a DDD-type repo in so little time without your products, so thank you !!

Chris Marisic

"Today I had an interesting experience, of guiding a customer from no application to a full blown app using FNH."

How exactly do you pass that off to a customer that has no experience with NHibernate? While the data access portion of NH is mostly straightforward the session management of NH is a nightmare. I don't see how any person could ever debug an issue they have with NH if it's related to session management if they're not nearly expert level knowledge of nhibernate.

This has been one of the largest flaws in ORMs that I've seen and why I've even started to fall back to using Linq2Sql for production usage when I only need a 2-3 table data access just because the session management pattern is so heavy and indepth it could easily add 30-50% more classes to a project.

Simplicity beyond all other reasons is IMO the number one reason to use a document database like Raven since session management is almost non existent and would never NEED to leave the repository layer unlike NHibernate that needs the correct session available the full life cycle of each operation for lazy loading.


FNH AutoMapping is phenomenal...I doubt I would have converted over to NHibernate (from linq2sql) without it.



I agree. Session management (or rather Session providing) is a part which really needs a bit of streamlining in NHibernate.


A - It always seems to come down to those choices. From time to time, I love just getting back into the XML simply because I know where all the buttons are...but, I often use FNH just because it means I get to talk about the OR/M and not XML files. Some people...gotta love 'em. Oh, and, my favorite complaint about NH - "What, you mean I gotta write classes?" Uh? You are a programmer, right?


Yup all you need is ADO.NET and SQL. The rest is overhead.

Jason Meckley

how hard is session management?

web = session per request

windows service = session per thread (assuming some sort of messaging service)

desktop = session per form

with factory.GetCurrentSession() and a CurrentSessionContext you are set. I don't think it's that much different than Raven.

then again, any time I'm leaving the scope of session I use a view/message specific DTO instead of the entity itself.

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - about one day from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats