What is new in NHibernate 4.0?
The General Availability release of NHibernate 4.0.3.400 was released on August 17 2014. This is the latest release of NHibernate as of the time of writing of this book. This release is quite important from a lot of perspectives. This is a major release of NHibernate that has come almost after three and a half years, so it contains a lot of interesting features and bug fixes.
If you are new to the ORM land or have never used NHibernate before, then you may not find this section very interesting. But hey, why not keep reading and you might find something that strikes a chord with you:
- NH 4.0 is built for .NET 4.0. This may not mean much for the users of NHibernate 4.0 as you can still use older versions of NHibernate on a project that is built on .NET 4.0. However, this is a major move for NHibernate since it now gives NHibernate developers the ability to utilize new features of .NET 4.0. An immediate consequence of this was that NHibernate 4.0 now does not depend on the
Iesi.Collection
library to support sets (Iesi.Collections.Generic.ISet<T>
) because .NET 4.0 has native support for sets, in the form ofISet<T>
, and implementations such asHashSet<T>
. Back in the days when the old versions of .NET did not have support for sets, theIesi.Collections
library offered a mature set functionality. NHibernate had a dependency on this external library as NHibernate uses sets to represent collections. - Support for SQL Server 2012 has improved with the implementation of the native
IIF
function, query paging, and SQL Server 2012 sequences. - "Mapping by code" rids you of having to write and maintain cumbersome XML mapping files. However, the general audience was never happy with this feature as it was buggy till recent times. NHibernate 4.0 has several defects in this area fixed, thus giving Mapping by code a facelift.
- We all love LINQ and we all hated the fact that NH's LINQ support never matched that of Criteria or QueryOver. There has been great community contribution in this area with over 140 issues fixed. LINQ support in NHibernate 4.0 has matched that of other query providers in a lot of respects. We will be using this feature a lot in the coming chapters of this book.