TypeInitializationException When Getting an NHibernate Session

Posted by Paul Johnson on Stack Overflow See other posts from Stack Overflow or by Paul Johnson
Published on 2010-03-17T09:57:17Z Indexed on 2010/03/17 10:11 UTC
Read the original article Hit count: 405

Filed under:

I’ve run into what appears to be an NHibernate config problem. Basically, I ran up a simple proof of concept persistence integration test using NUnit, the test simply querys an Oracle database and successfully returns the last record received by the underlying table. However, when the assemblies are taken out of the NUnit test environment and deployed as they would be for an actual application build, my call for an NHibernate session results in a ‘TypeInitializationException’ whilst executing the code line:

sessionFactory = New Configuration().Configure().BuildSessionFactory()

The application is a vb.net console app running against an Oracle 9.2 database, using a ‘coding framework’ published on the web by Bill McCafferty entitled 'NHibernate Best Practices with ASP.NET' (pre S#harp Architecture). I am running version 2.1.2.4000 of NHibernate.

Any assistance much appreciated.

Kind Regards

Paul J.

© Stack Overflow or respective owner

Related posts about nhibernate