which version of fluent nhibernate is compatible w

2019-03-24 15:39发布

问题:

i see when i install fluent nhibernate 1.2 from Nuget, it downloads nhibernate 3.1. If i want to use nhibernate 3.2, how would i do that through nuget and it is compatible with fluent nhibernate 1.2 ?

回答1:

Currently, the FluentNHibernate package from the offical NuGet package source, depends on NHibernate.Castle 3.1 (currently, there is no newer version yet), which in turn depends on NHibernate 3.1 (the exact version, not 3.1 or higher). Therefore, NuGet infers a dependency on NHibernate 3.1 when installing FluentNHibernate.

So the bottom line is: you can't, until the FluentNHibernate package is updated.

The most practical way around is getting the latest FluentNHibernate source code and building it against NHibernate 3.2. I've tested that and it seems to work just fine. You might even be fine using assembly binding redirects, but I haven't tested that.

Alternatively, you can wait for NHibernate 3.2 to reach GA (final) and FluentNHibernate to catch up, but of course that's not a very satisfying answer.



回答2:

If you use the Nuget Package Manager Console instead of the GUI to get the package (Install-Package FluentNHibernate) you will get version 1.3.0.717 which is compatible with NHibernate 3.2

I tried it and is working fine for me.



回答3:

Here you can read about plans to release FluentNHibernate for 3.2GA soon and a suggested workaround using attributes

http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/8e782e45ed9ba647

I got my working using

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="NHibernate"
                      publicKeyToken="aa95f207798dfdb4"
                      culture="neutral" />
    <bindingRedirect oldVersion="3.1.0.4000"
                     newVersion="3.2.0.4000"/>
  </dependentAssembly>
</assemblyBinding>