VMG
VMG

Reputation: 135

MVC 6 .NET Nhibernate DNX core 5.0 - Not available

Im add to project Fluent and Fluent NHibernate and I have on Fluently: Project.DNX Core 5.0 - Not available.

ISessionFactory sessionFactory = Fluently.Configure()
            .Database(MsSqlConfiguration.MsSql2012

I dont know what to do.

Upvotes: 1

Views: 1939

Answers (3)

Tim Taurit
Tim Taurit

Reputation: 9279

I searched for a while to see if there are plans to bring NHibernate to the new, cross-platform .NET Core and here is what it looks like:

  • It doesn't seem that that anyone is working on it at the moment or consider it important,
  • NHibernate have some dependencies on libraries that at the moment aren't compatible with .NET Core. Even if they were, it would require some breaking changes to make NHibernate itself compatible,
  • There doesn't seem to be much activity going on in the NHibernate project.

If I understand it correctly, it means that if you want to target Linux/Mac platforms with your MVC6 application, and you wanted to use NHibernate with it, hold no breath as it won't happen.

In this situation, Entity Framework Core seems to me like the natural alternative to use and learn. It's open source, actively developed, with good opinions among developers, and designed with MVC 6+ in mind.

Upvotes: 0

Mausam
Mausam

Reputation: 409

If you don't want to edit project.json you can put,

#if DNX451
//whatever code is giving issue with DNX Core 5.0
#endif

You can use this anywhere even when defining namespaces, e.g. what I recently used in my asp.net project for using Xml was;

#if DNX451
using System.Xml;
#endif

Upvotes: 0

Kamil Sokołowski
Kamil Sokołowski

Reputation: 333

As far as I remember NHibernate works only now only on dnx451 framework. If you are compiling it for Windows you can remove dnxcore50 from frameworks in project.json

Upvotes: 3

Related Questions