What I look for in a ORM
In just about every application I build that use a relational database, I also use a orm tool to handle my data access. The reason I do this is to save myself the time it takes to handroll a data access layer in ADO.Net and to eliminate buggs that can come from writing sql queries. I do have a few things that I look for in a professional orm that I think is important:
- Transparancy
- Extensability
- Linq support
- Preformance
1. Transparancy
The most important feature of a orm, in my opinion, is that it should be transparant. This means that you, as a developer, should not constantly be remindad what tool you are working with. The orm itself should sit in the background and handle the persistance without you noticing it. You should, in my opinion, have a clean domain model that has no direct dependency on you'r orm while the mapping itself should be seperated from the domain. You should be able to, freely, shoose the types all the types on your model and map it to the underlaying database.
2. Extensability
No tool work perfect for every solution out of the box. This is why it's important to have extensability points that the developer can use to make it fit his/her needs. With a good architecture a tool can give the developer a very free hand on how he/she want's to extend it and make it fit any application.
Many extensability points will also encourage developers to create third party tools to help development with a certain orm. And when you find those tools that you like, it will speed up your development process, and you can focus on some other part of the application.
3. Linq support
Linq support is allways a good thing to have in a orm tool, as it is built into the language we use and we are used to use it in our every day work. It makes us write strongly typed queries and we are not forced to learn a new API or querying language. A good linq provider can mean a lot to a orm and help the developer eliminate "magic string bugs".
4. Preformance
Preformance is, of course, a very important part of a orm as it will handle a lot of trafic between the database and the application. The reason I put it last on my list is that it will not be a huge difference between two professional tool on basic CRUD queries. Most orm's will send very similar sql to the database for 90% of your queries. A orm should, however, be cacheing your queries and make sure you don't hit the database more then necessary.
Those are the features I think is the most important once to have in a professional orm. My personal choice is NHibernate, which I think cover those points pretty well. The one thing I think need improvment in NHibernate is the linq provider. This provider is still under development. Other then that, I think NHibernate is the most complete orm for the .Net framework.