Good news everyone! NHibernate 5.1 is released with the support of .NET Core 2.0 and .NET Standard 2.0.
NHibernate supports .NET Core 2.0
The NHibernate community is killing it. It’s the second major release in a short amount of time. This one is even bigger and more anticipated than the async operations support: you can now run .NET applications with NHibernate on Linux.
There are a couple of issues with MySQL because of bugs in the MySQL provider. However, MS SQL, Oracle, Postgres, and Firebird should work fully.
Here’s an output of a small application I wrote to test it with Azure MS SQL and Ubuntu:
Note that FluentNHibernate doesn’t yet support .NET Core and .NET Standard but it seems like it will shortly too. For now, you can use the built-in mapping-by-code functionality which is pretty similar to that of FluentNHibernate.
When .NET Core 1.0 came out, I thought that it was it. ADO.NET API was cut significantly in that release. So much that there weren’t even the most basic classes like DataSet, DataTable and so on. The EF Core team had to re-implement a lot of this API from scratch on their own. It was clear that open source libraries didn’t command the same amount of resources and manpower, and so it wasn’t feasible to convert NHibernate to .NET Core in any foreseeable future.
Thankfully, with .NET Core 2.0, Microsoft added back almost all of the missing ADO.NET APIs. Which made it possible to finally introduce .NET Core / .NET Standard support to NHibernate.
This release arguably makes NHibernate the most advanced ORM in .NET functionality-wise.
For long-term readers: I plan to do another comparison between Entity Framework and NHibernate from the Domain-Driven Design perspective soon. It will be similar to this old one. Will describe how EF Core 2.0 deals with encapsulation issues, handles Value Objects, and more. I’ll try to do that after I finish my unit testing anti-patterns series.