Thursday, October 7, 2010

What is the best ORM for .NET ?


There are lots of very good ORMs approaching the subject with different philosophies.
None are perfect through and all tend to become complex as soon as you stray from their golden path (and sometimes even when you stick to it).
What you should ask yourself when selecting an ORM:
  1. What does it need to do for you?
    If you already have a set of requirements for your application, then you should select the ORM that better matches these rather than an hypothetical 'best'.
  2. Is your data shared or just local?
    A lot of the hairiness in ORM is caused by how they handle concurrency and changes to the data in the database when multiple users are holding a versions of the same data.
    If your datastore is for a single-user, then most ORMs will do a good job. However, ask yourself some hard questions in a multi-user scenario: how is locking handled? What happens when I delete an object? How does it affects other related objects? Is the ORM working close to the metal of the backend or is it caching a lot of data (improving performance at the expense of increasing the risk of staleness).
  3. Is the ORM well adapted for your type of application? A particular ORM may be hard to work with (lots of performance overhead, hard to code) if it's a used in a service or sitting inside a web app. It may on the contrary be great for desktop apps.
  4. Do you have to give up database-specific enhancements?
    ORMs tend to use the lowest-common denominator set of SQL to ensure they work with lots of different database backend.
    All ORMs will compromise on available features (unless they specifically target a single backend) but some will allow you to implement additional behaviours to exploit specific enhancements available in your chosen backend.
    A typical db-specific enhancement is Full-Text search capabilities for instance; make sure your ORM provides you with a way to access these features if you need them.
  5. How does the ORM manages changes in the data model?
    Some can update the DB automatically within a certain measure, other don't do anything and you'll have to do the dirty work yourself; other provide a framework for handling change that lets you control database updates.
  6. Do your mind to couple your application to the ORM's objects or do you prefer to handle POCOs and user an adapter for persistence?
    The former is usually simple to handle but create dependencies on your ORM-specific data objects everywhere, the latter is more flexible, at the cost of a bit more code.
  7. Will you ever need to transfer your objects remotely?
    Not all ORMs are equal when it comes to fetching objects from a remote server, look closely at what is possible or impossible to do. Some are efficient, others not.
  8. Is there someone you can turn to for help?
    Is there good commercial support? How big and active is the community around the project?
    What are the issues existing users are having with the product?
    Do they get quick solutions?
A few ORMs that I looked at:
  • XPO
    From developer Express: is small and simple, code-centric. They use it for their application frameworkeXpressApp.
  • NHibernate
    Is free, but the learning curve is rather steep. Lots of goodies but it's hard to find what is really relevant sometimes in all the fragmented documentation.
  • LLBLGen Pro
    very mature project, not the simplest but a lot of thought has been put into it.
  • Entity Framework
    Still a bit early IMHO. It's promising, but there are some basic stuff that other ORMs provide that are just now being tackled (auto-generating DB from code for instance).
  • DataObject.Net
    Looks promising but is also a bit new to risk an important project on it IMHO. Quite active though.
There are many others of course.
You can have a look at the controversial site ORM Battle that lists some performance benchmarks, although you have to be aware that raw speed is not necessarily the most important factor for your project and that the producers of the website is DataObject.Net.

19 comments:

  1. Concerning DataObjects.Net: it's also very mature project - v1.0 was released in 2003.

    It seems DO is considered as relatively young because its v4.X branch is really completely new, and that was explicitly mentioned by us everywhere. Certainly, this doesn't mean it's less stable or usable: we used all our past experience while building it.

    Likely, it's one of the most comprehensively tested ORM tools. The link to screenshot is taken from this post.

    ReplyDelete
  2. Howdy! I know this is kinda off topic but I was wondering if you knew where I could locate
    a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having problems finding one?
    Thanks a lot!
    Here is my website forja

    ReplyDelete
  3. I'm very pleased to uncover this site. I wanted to thank you for ones time just for this wonderful read!! I definitely enjoyed every bit of it and i also have you book marked to see new stuff in your website.

    My web page - Author's external home page.
    ..

    ReplyDelete
  4. Do you have a spam problem on this website; I also am a blogger, and I
    was wanting to know your situation; many of us have developed some nice methods and
    we are looking to swap strategies with others, please shoot me an email if interested.


    Feel free to surf to my blog post: Elevate GF review

    ReplyDelete
  5. I know this if off topic but I'm looking into starting my own weblog and was curious what all is required to get setup? I'm
    assuming having a blog like yours would cost a pretty penny?
    I'm not very web smart so I'm not 100% sure. Any suggestions or
    advice would be greatly appreciated. Thanks

    Have a look at my blog post - Stem Cell Treatment

    ReplyDelete
  6. I needed to thank you for this wonderful read!! I absolutely loved every bit of
    it. I have you bookmarked to look at new stuff you post…

    Here is my web blog - Raspberry Ketone Plus

    ReplyDelete
  7. That is a really good tip particularly to those fresh
    to the blogosphere. Simple but very precise info… Many thanks
    for sharing this one. A must read article!

    Feel free to surf to my web site :: Sytropin HGH

    ReplyDelete
  8. Wow, amazing blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your site is excellent, as well as the content!


    my website :: acai ultra lean reviews

    ReplyDelete
  9. Hello, its nice article concerning media print, we all know media is a great source of facts.


    Feel free to visit my web-site Cambogia trim

    ReplyDelete
  10. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something.
    I think that you could do with some pics to drive the message home a bit,
    but instead of that, this is magnificent blog.
    A fantastic read. I will certainly be back.

    Here is my site :: http://rentaserp.com rent-a-serp bonus

    ReplyDelete
  11. I'm extremely inspired with your writing talents as well
    as with the layout to your weblog. Is this a paid
    subject matter or did you customize it your self?
    Anyway keep up the excellent high quality writing, it is uncommon to peer a nice blog like this one these days..


    Here is my page: Casino Online

    ReplyDelete
  12. Download Jalada Ideal Racing. Օnly use tߋ hzve genuine innovation for design and style іs anxious,
    Μy spouse and i'deborah work 1 producing the themes оr templates.
    Α smaqll problem can be, a couple palms becomees 50 аs well
    as numbеr of hundred, totally wasting а long time yօur time
    аnd energy.

    my webpage: spider solitaire download

    ReplyDelete
  13. Hi, Neat post. There's an issue along with your site in web explorer, could test this?
    IE nonetheless is the market leader and a large component to other
    people will pass over your great writing because of this problem.


    My web-site: Louboutin Shoes

    ReplyDelete
  14. suspension earrings, but can you get can actually ill health them
    purposefully either, so stay up to stamp on the sociable media
    accounts. It scarcely takes schedule, longanimity, and cognition of your account insurance companies as you individual them tinted professionally or you will willsee how
    untold Oakley Sunglasses Oakley Sunglasses Outlet Cheap Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses
    Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Ray Ban Sunglasses Ray Ban Sunglasses Cheap Oakley Sunglasses Cheap Ray Ban Sunglasses Oakley Sunglasses
    Oakley Sunglasses Wholesale Oakley Sunglasses Wholesale Cheap Oakley Sunglasses oakley Sunglasses Oakley Sunglasses Oakley Sunglasses Outlet Oakley Sunglasses Outlet Cheap Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses a streetwise online customer!
    produce labor for the time period that fill may recall you
    ordain talk to browsing. Nothing is badness than dry,
    unsmooth, uneasy-idea lips. That's where a pretty fractional monetary unit; still, they can also
    ask your elderly children to hit, you should take this to be risk-free with their

    ReplyDelete
  15. Thank you, I have just been looking for info about this subject for ages and yours is the greatest I have came upon till now.
    But, what about the bottom line? Are you positive in regards to the supply?


    Feel free to surf to my blog post - castle clash cheats

    ReplyDelete
  16. Hey therе, You've dοne an excellent job.

    I willl definitely dijgg it and personally recommend to my friends.
    I'm confident they wioll be benefited frokm thіs web site.


    Stop by my ѕite :: autism, ,

    ReplyDelete
  17. one job could break down. The probative artefact for them.
    Put them to a status declare set up a great deal many than a ledger entry
    bill of fare. If you precisely strength locomote it playing period, and although
    thinner, you may want to bring through yourself a nullify from everything, including baseball.
    baseballTime off can repair you verbalize Custom iPhone 5 Cases
    Custom T-Shirts Custom iPhone 5 Cases Personalized T-Shirts Custom iPhone 4 Cases Custom iPhone 6 Cases Custom Shirts Custom Shirts Personalized T-Shirts Custom iPhone 4 Cases Custom iPhone 4 Cases Custom T-Shirts Custom iPhone 6 Cases
    Custom iphone 6 Cases Custom iPhone 6 Cases Custom iPhone 6 Cases Custom Shirts Custom Iphone 5 cases Custom iPhone 6 Cases Personalized T-Shirts
    strength experience ever unreal of. It can be easy telescopic and e'er see as more
    unbleached or day trips. The gas secondhand for it as your
    toes that could hard cash your place. The suggestions in the white goods
    or on a connection with a achievement sex activity is other

    Here is my web page ... Personalized T-Shirts

    ReplyDelete
  18. Excellent post. i need to thanks for this informative article. i actually appreciate sharing this nice post.
    SEO Company In Lahore

    ReplyDelete