NHibernate Or Bust!
So my interest in NHibernate is picking back up again. The 1.2 beta release that’s circulating now (the candidate release has been out since February of this year) addresses various issues with NHibernate in my previous time with it.
Specifically, the biggest issue was native support for generic types. In addition, it seems like there are various other goodies in the 1.2 release such as stored procedure support.
And to think, I just got the team to standardize on Microsoft Enterprise Library 3.0. I’m wondering how to break this to the team.
I guess in a sense, they are not completely incompatible. Roll your own queries and data access routines are still the way to go for more complex queries (does NHibernate handle FOR XML EXPLICIT?) and anywhere high performance is critical.
The beauty of this whole thing is that as NHibernate has gained traction since the first time I used it like 2 years ago, the tool support has evolved tremendously. Combined with MyGeneration and user templates, I was up and running (although the generated output had some minor errors in the XML mapping file) in minutes. Not only has the tool support improved, the documentation has improved as well.
There is still some conflict, internally, as I was just ragging on LINQ last week with another group of developers for the simple fact that it creates a tight coupling between code and the raw data. Whereas with stored procedures, you can have dedicated DBAs write highly performant code and you can modify the underlying data retrieval and layout so long as you maintain the same resultset, with dynamic queries, you lose a lot of that flexibility. In addition, you lose a bit of testability as well since many times, it’s just really helpful to be able to test the SPROC independently of any code (or perhaps breakdown subqueries in the SPROC to test small subsets of data).
In actuality, I think that having the mappings as XML is probably better than using LINQ since the XML mapping files can be loaded at runtime, meaning that the deployed mappings can still be manually updated whereas LINQ would necessitate a recompile of the source (my understanding of it).
So if you haven’t checked out NHibernate for a while, now’s a good time to get a refresher and re-evaluate the library. I think it will still stick around even after LINQ is released.