The Best O/R Mappers: NHibernate, LLBLGen Pro, and EntityBroker

Frans calls me to task on my last blog post where I said:

"By the way, this is also the one of the few things that I think still makes my mapper stand out as unique against the likes of NHibernate, LLBLGen Pro, and EntityBroker.  The others may have more features, and NHibernate is open source, but just try to use any of these others for the first time in 30 minutes, or just try to extend any of those to have a new feature you desire.  Of course the other main thing mine has to offer is provider support -- I don't think any other can claim to support so many databases.  And that's not just a claim -- its also a reality that many have proven -- a reality that is possible primarily due to simplicity and not targetting every possible feature."

Sorry Frans if this offends you, as that was not my intent at all.  I've tried most of the mappers out there, and there's a reason why I mentioned LLBLGen Pro, NHibernate, and EntityBroker -- they are the best out there in my opinion!  I think I've also proven that I do in fact recommend many people to your mapper and the others, so I was not trying to say anything negative at all.  Do I think your mapper is easy to use -- absolutely -- and I also think most other mappers are easy to use.  LLBLGen Pro is also probably unique in that it actually gets easier to use over time, due to the code gen approach that you take which makes intellisense possible.  But I still think that too many people totally new to O/R mapping get frustrated and quit when it takes longer than 30 minutes to get working the first time.  Is that fair?  No, its not, but that's the type of developer that the MS community often brings us -- they download our cool products and get frustrated when our products can't read their minds and tell them what they are doing wrong -- then they quit and go on their way content in their belief that O/R mappers are not the right approach.  And that's been one of my goals -- too give people an entry point that is simple enough that anyone can use it in 30 minutes or less -- then if they need more they will be much more willing to consider the other mappers.  Are there people that get yours working in 30 minutes?  I'm sure there are, but I seriously doubt that the average MS developer can get most O/R mappers, and many other cool tools for matter, in 30 minutes or less -- and I don't think that's a negative statement about your mapper.  As I said earlier, LLBLGen Pro is probably unique in its code gen approach, which probably makes it actually get easier to use over time -- and that's very cool.  Your mapper is hands down the only mapper I would recommend to anyone that those that prefer code gen -- yours and not mine -- although that's not my personal preference.

Next Frans, you asked how many databases my mapper supports really supports?  MS SQL Server, Oracle, Access, MySql, PostgreSql, Sqlite, Firebird, DB2, VistaDB, Sybase, and lastly I think SqlCE.  All of those have people that I know for a fact are using my mapper with them, except for SqlCE which I know some people were interested in using but I never heard back to know if they succeeded or not.  Furthermore, unlike other mappers, if you work with another database that I have not listed, you can probably get it to work with my mapper without writing or modifying any driver code -- no recompile necessary.  But yes, you are absolutely correct too when you say that I don't "really" support all theses databases, if you what you mean by that is supporting features that are peculiar to individual databases.  Do I support sequences?  Yes, but it does require that you know how to set it up in your database, which yours probably does automatically.  Do I support joins, aggregates, group by, having clauses?  No, not even on one database -- as I have said on many occasions, LLBLGen Pro has far more features than mine, as does NHibernate and EntityBroker -- mine simply targets the most common 80-90% (or more) of CRUD, with or without stored procs, while giving the user a decent DAL for the other cases.  Many people may read that and immediately choose your mapper, or one of these others, and that's absolutely the right thing to do if you need these features, but many people have also apparently decided that they were quite content with a mapper like mine too.  For instance, I actually do work with joins, aggregates, group by, and having clauses -- in my databases -- that's right, I'm quite comfortable writing a view or stored proc and mapping it.  That's a "heresy" too many purists -- but I like databases -- my mapper doesn't shield me from the database -- it simply allows me to avoid writing all the boring and repetive CRUD and start working with objects right away.

I thought about ending here by saying when I would recommend LLBLGen Pro vs. NHibernate vs. EntityBroker -- but that would probably just cause more issues since I would be making some generalizations to some degree.  So instead I'll end it by just challenging everyone that reads these blogs but still hasn't tried an O/R mapper to just try one and see for yourself for a change.  And I'm very sorry if any of my statements, here or earlier, are generalizations that may be debateable -- that was not my intent and I apologize sincerely.  I consider myself an O/R mapping evagelist more than an O/R mapping vendor (and I'm certainly not a fulltime vendor, nor do I make enough money to quit my day job) -- but there is a fine line that sometimes I inadvertently cross in my comments.


  • What are your thoughts on Gentle.NET?

  • Hi Paul,

    Last time I used an OR mapper for a .NET project was in early 2002 when I ported the IBuySpy Portal to ObjectSpaces using the early beta framework.

    You should be able to find that still on GotDotNet (under my name David Taylor or DavTaylor).

    Personally, I am happy to wait for the final release of ObjectSpaces / WinFS. have probably already guessed that I am a very patient man (currently I am assuming a 2007-2008 deliverable).

  • David: Not only will you have a long wait, but I think the other mappers on the market have proved that MS OS will never be the best!

  • Wooh, was he really that upset?

    I use LLBLGEN, and I have to say I'm definitely a happy customer. It probably took me more than 30 minutes to figure it out initially, though, because I ultimately chose the self-servicing templates with base entities, which isn't the default.

    As for NHibernate ... I just find it more natural to start with the DB, to go R->O in other words rather than O->R. O->R mappers like nhibernate and wilsonormapper also require you to define your database twice (once in the db and once in the config), thereby breaking the DRY principle.

    With LLBLGEN's cmdline generator, I might even be able to just vaguely point at the database and say "uh, do that database over there and stick the code here" ... and get a full model with just those two config variables! That, combined with a magic assembly re-compiler, would be even better than Ruby on Rails, whose ActiveRecord is really, really simple, but still requires you to declare the tables and relationships.

    David: I've only been using .NET for 6 months, and maybe I got spoiled by the scripting world, but I've ended up junking layer after layer of MS-written frameworks. Now is gone for me, and I reimplemented it in 5 days and 500 LOC without all the negative baggage. Do you really think given their history that objectspaces is going to get even close to the hype?

  • Steve (and Paul),

    I was partly being sarcastic with my prior response, I mean....realistically who can now wait until 2007 or 2008 for any project you are planning right now?

    When I first worked with ObjectSpaces in 2002 (using a beta they released in late 2001) I had assumed it would come with .NET 1.1 in early 2003 (but of course it did not).

    I think you are being a little hard on Microsoft. I would much rather have nothing now from Microsoft, and use one of the great products available (from Paul, NHibernate, etc) and let Microsoft plan a coherent strategy. The worst case scenario would be for Microsoft to have 2-3 O-R mapping frameworks, and given WinFS is being worked on, it was the right decision to delay ObjectSpaces and try to merge or align the technologies.

    Can I also give you some advice regarding .NET? This is particularly important if you have come from another background (ie PHP, Java, etc).

    Programming has been one of the biggest parts of my life since around 1981 and.....over the last 20+ years..... the ASP.NET framework (particularly what is coming with Whidbey) is one of the best frameworks I have ever worked with. Whidbey just fills in lots of areas that were missing from the V1 release.

    It is just that any framework will seem "wrong" to you if you have never used a framework with similar concepts before.... You need to reset your way of thinking before things start to make sense.

  • Tod: I just started looking at o/r mappers. It sounded cool, but it was/is very new to me. I searched a bit and found Wilson's, LLBLGen Pro and EntityBroker. I installed Wilson's: looked v. simple and reading a bit I found that I was looking for more functionality. Installed LLBLGen and generated some code in like 10 min. I didn't really understand the code just by looking at it so I installed EntityBroker. It installed but didn't work (crashed on db connection - some bug). In addition Thomas acts like he knows everything the rest should live to admire him - not to nice working with people like that on the long run. I droped EntityBroker but I didn't want to give up on o/r mappers yet so I went back to LLBLGen and opened the help - yeh, I know :). After max an hour I understood the generated code and realized that LLBLGen pro is great ...

  • Just to update the dabases that your Wilson mapper supports....

    I use your Wilson OR Mapper with your ado xml provider (ok, slightly modified... and... It's not really a database ;o)

    Best regards

    Rasmus Lindgren

  • Paul,
    What is your opinion about EntitySpaces. Is their Dynamic SQL implementation good?

  • Sorry, but I'm not familiar with an EntitySpaces product. I searched and found what I guess you are referring to, and it appears to be by the same person behind MyGeneration. But I'm not familiar with it, so I can't comment on it.

Comments have been disabled for this content.