A look at .NET Object Relational Mappers (ORM)s
September 09, 2009
- Linq to Entities/Entity framework
- Persistor .NET Express
- NHibernate / Active Record
This post looks at the many different ORM (object relational mappers) that exist for C#/.NET. These Object Relational Mappers aim to bridge the gap that exists between database servers and their native SQL, and the object-oriented world of non-tabular data.
My main source for the ORMs I chose to look at were from csharp source and wikipedia along with a codeplex search, and just general knowledge of the products out there. I’ve excluded dead links from wikipedia, commercial ORMs (of which lots also exist) and narrowed it down the ones that seemed fairly mature and easy to assess from available walkthroughs.
I’ve been using ORMs since around 2005 in both proprietary and open source format, but right now I use NHibernate and ActiveRecord in my daily job. Having used this for almost a year I was curious what the competition was like 3 years on and being indoctrinated into the Active Record pattern, which once you start using makes others seem clumsy. I wouldn’t be switching anytime soon as NH/AR are my job (and as I found out I wouldn’t want to) but I did manage to test Subsonic and the Entiy Framework quite extensively with the Soot project I’ve been making.
Anyway, my criteria for assessing and ORM was:
- “Turnkey” abilities of it, or how easy it is to just dive in
- The documentation, support (through forums, FAQ, knowledge bases)
- The date of the last release, to indicate how fresh/stale the project is
- Ease of use and flexibility of the API
- Caching and performance
- Others: inheritance, complex relationships, concurrency
The 2 most important features, in my view, of an ORM though are:
- Querying - dynamic filtering, quality of SQL produced, joining, paging, eager/lazy loading
- Save/Create and unique id handling and ease of use of CRUD operations