How to upgrade your apps to NHibernate 3.2 with Fluent NHibernate 1.2

Since version 3.0 the number of files that NHibernate uses shrink. So first, you need to know what kind of files you need to update and delete.

In version 3.0 NHibernate:

    • NHibernate
    • Iesi.Collections
    • Remotion.Data.Linq
    • NHibernate.ByteCode.Castle
    • Castle.Core
    • Antlr.Runtime

In version 3.1, Antlr.Runtime and Remotion.Data.Linq have been ILMerged into NHibernate

  • NHibernate
  • Iesi.Collections
  • NHibernate.ByteCode.Castle
  • Castle.Core

In version 3.2,  NHibernate integrates a default lazy provider based on LinFu

  • NHibernate
  • Iesi.Collections

To upgrade to the last version 3.2 you need to update the last two DLLs and delete the rest ( here ).

If your app uses any DLLs from NHibernate Contrib you need to update them to the version 3.2.

Next you need to download Fluent NHibernate 1.2 ( here ).

After the update of Fluent DLLs is necessary to change the fluent configuration, to start using the default lazy proxy.

From:

.ExposeConfiguration(c => c.SetProperty( Environment.ProxyFactoryFactoryClass, typeof( ProxyFactoryFactory ).AssemblyQualifiedName))

 

To:

.ExposeConfiguration(c => c.SetProperty( Environment.ProxyFactoryFactoryClass, typeof( DefaultProxyFactoryFactory ).AssemblyQualifiedName))

 

And because Fluent 1.2 expects NHibernate 3.1 you need to redirect the DLL in .config.

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

 

Is possible to avoid the redirect, if you download the source code of Fluent NHibernate 1.2 and create a build with NHibernate 3.2 DLLs.

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *