I just got the following email question from a friend:
If I’m stuck in one of those loony shops that mandates that all data access has to be done via stored procedures, will NHibernate buy me much? In other words, if the tool’s purpose is to eliminate me writing SQL, but I have to write SQL anyway, is there a point?
I’ve only been using NHibernate for about 6 months and am barely struggling to emerge from the newbie stage, but my gut instinct says that you would loose about 90% of the benefits if you only ever used sprocs with NHibernate.
However, if I were in my friend’s situation I would probably still use it.
Why?
The main reason isn’t because of time or productivity savings, but rather because I would bet on the long-term viability of NHibernate and ORM’s in general.
NHiberate is already pretty mainstream and becoming more popular every day. The fact that Microsoft is now fully invested in the ORM space with the Entity Framework means that it will only be a matter of time before the traditional sproc-only mentality finally disappears from even the most conservative software shops.
In the meantime, I’m guessing that I would be able to speed up that process by introducing NHibernate into my application and my workplace even it would be under less than optimal circumstances and not save me much (if any) time in the short term.
Based on my experience with human nature, I’m betting that once NHibernate is in the dev and production environments for a while, the other developers and administrators would get used to it and eventually loosen up enough to let me start mapping directly against tables. It’s a slight gamble, but one based on pretty predictable human behavioral traits.
If nothing else, it’s much more convincing to show someone a proof of concept based on an existing app in production that you only have to slightly modify rather than on a silly Northwind example.
As far as more technical reasons, I leave this up to the more advanced NHiberate using reader to comment on. My sense is that you could still cut down on some tedious mapping code (right to left assigment stuff), but using Fluent NHibernate’s Auto Mapping feature, but I haven’t tried this out yet on sprocs so that may be (at least for now) a dead end.
Are there any other compelling reasons to use NHibernate if you worked in a shop that mandated using only sprocs for data access?
Popularity: 10% [?]