Ayende @ Rahien

Refunds available at head office

On Fluent NHibernate

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.

Comments

Ajai Shankar
08/15/2010 03:04 PM by
Ajai Shankar

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

Did you mean ConfORM-able? :-)

Ajai

James Gregory
08/15/2010 05:55 PM by
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.

Thanks

Tom Janssens
08/16/2010 09:16 AM by
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
08/16/2010 12:45 PM by
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.

Jeff
08/16/2010 04:50 PM by
Jeff

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

gunteman
08/16/2010 10:29 PM by
gunteman

@Chris

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

Chuck
08/17/2010 01:32 AM by
Chuck

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?

z
08/17/2010 03:04 AM by
z

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

Jason Meckley
08/17/2010 08:28 PM by
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.

Comments have been closed on this topic.