NHibernate v3.x vs. v4.x

LLBLGen Pro supports both NHibernate v3.x and NHibernate v4.x. The target framework 'NHibernate' is targeting NHibernate v3.x, and the target framework 'NHibernate v4' targets NHibernate v4.x. The v3.x framework is named 'NHibernate' and not 'NHibernate v3' for backwards compatibility reasons.

Both frameworks support the same features, except NHibernate v4.x is .NET 4.0 or higher. The main difference in generated code between the two is that for NHibernate v4.x, the entity model project won't reference Iesi collections anymore and will use .NET 4.x ISet/HashSet objects instead of the Iesi variants.

Migrating your project from 'NHibernate' to 'NHibernate v4'.

If you're currently using 'NHibernate' as target framework in LLBLGen Pro and want to use 'NHibernate v4', please follow the following steps to migrate your project.

  • Load your 'NHibernate' using LLBLGen Pro project in the LLBLGen pro designer
  • In Project Explorer, right-click the target framework node 'NHibernate' and select 'Switch target framework' from the context menu.
  • In the pop-up dialog, select 'NHibernate v4'. The designer will make a backup of your project file prior to switching over, so you can always go back.
  • Save your project and re-generate your code.
  • If your generated VS.NET projects target .NET 3.5, make sure they now target .NET 4.0 or higher, by changing the .NET framework version in VS.NET for the geneated projects. LLBLGen Pro doesn't overwrite VS.NET project files (only updates them with new references) so you have to make this change manually.
  • Update the references in the generated VS.NET projects to reference NHibernate v4.x from nuget. Remove the Iesi collections reference from the Model vs.net project.
  • In the hibernate.cfg.xml file (if you're using hbm files), remove the bytecode factory directive if you have set it to an incompatible one. NHibernate v4 uses an internal factory. The designer doesn't overwrite the hibernate.cfg file so this change has to be made manually.