Say Hello to Fluent NHibernate

I’ll let James Gregory do the introduction for Fluent NHibernate here.  I think this project has a lot of potential to dramatically reduce the difficulties teams face when working with NHibernate.  The initial focus is on a fluent interface mechanism for NHibernate configuration, but I’m hopeful that it grows into the easiest way to use NHibernate

In a nutshell, what if…

  • You could configure NHibernate with Intellisense and zero, I said zero, Xml?
  • You had some easy tooling for testing out NHibernate mappings?
  • You could make significant shortcuts in your persistence mapping by setting sensible project conventions once and only once?
  • You could start with a reference architecture for a Repository?
  • You had sample “recipes” for bootstrapping NHibernate with the common IoC tools?

 

The guys doing Fluent NHibernate are going gangbusters getting this thing ready to go.  Nice job guys.

 

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Database and Persistence, IOC. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://www.codingcockerel.co.uk Ross Neilson

    I concur with all of the benefits outlined above.

    However a plus point for the XML config was that, should your column names change, you could update the mappings and everything would keep working, without the need for a recompile. Assuming you were loading the mappings at runtime rather than compiling them into the assembly of course.

    Developers using the fluent interface are closing off this flexibility.

  • http://colinjack.blogspot.com Colin Jack

    @Ray
    Just to say if the project you describe is still around then you can easily verify many aspects of the mapping using this approach:

    http://codebetter.com/blogs/david_laribee/archive/2008/06/17/test-your-nhibernate-mappings.aspx

    Ayende has blogged about this sort of thing too.888

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    @Brian,

    Yeah, but be one of the cool kids and say “XmHell”

  • Brian Johnston

    ‘XML Hell’ I love that! Managers will get that too since they’re all too familiar with being burnt by DLL hell a decade ago. I’m using it!

  • http://lexicalclosures.blogspot.com/ Ray Vega

    That is definitely a nice and better way to configure NHibernate instead of the xml files.

    On a previous project using NHibernate the xml mapping files were also troublesome, problematic, and even confusing to a lot of the developers on the team. Since we also did not have automated tests on them we usually did not know about any issues with the files until we ran the application.

    “XML Hell” is one of the main reasons why I no longer use NAnt for my build files and instead use an actual dynamic scripting language (Python) to handle those tasks.

  • Brian Johnston

    As I told James…finally and NHibernate I can get on board with. For years I’ve been screaming that XML configuration file != better application – for our team, on the application that we inherited, it result in more production runtime bugs then any other application I had ever worked on (until we got rid of 80% of configuration files and 100% of all the extra interfaces that were created solely for the ‘abstraction’ of the configuration files).

    Anyway, I think this is a great evolutionary step for NHibernate and I’m really looking forward to see this project completed. My experiences with NHibernate thus far have been nothing but frustration after frustration.

  • http://colinjack.blogspot.com Colin Jack

    Good stuff, I’m also very interested in your object-object mapping testing capabilities.

    I’ve thought about doing it myself but couldn’t work out how to do it for more complex cases, so definitely interested to see what you guys have produced.

  • Mike D

    Jeremy,

    Thanks for your work on this, you are dead on.

    I would like to see support for more ORMs like LinqToSql.