System.TypeInitializationException on sessionFactory

201 views
Skip to first unread message

Felipe Oriani

unread,
Feb 20, 2014, 11:14:00 AM2/20/14
to nhu...@googlegroups.com, fluent-n...@googlegroups.com
Hi friends, I'm creating a project with NHibernate in Windows Forms.
It was working fine but I update the reference of nhibernate to 3.3.1 and fluent nhibernate to 1.4 and I get a error with a message:

An unhandled exception of type 'System.TypeInitializationException' occurred in FluentNHibernate.dll

In the innerExceptions, I get a error message:
The type initializer for 'NHibernate.LoggerProvider' threw an exception.

The problem is, I do not have configured any log in the sessionFactory. What can I do to solve it? Look my code:

var config = Fluently.Configure()
    .Database(MsSqlConfiguration.MsSql2008.Dialect<MsSql2012Dialect>()
                                     .ConnectionString(c => c.FromConnectionStringWithKey("Default"))
   .AdoNetBatchSize(50)
   .QuerySubstitutions("true 1, false 0"))
   .Cache(c => c.UseQueryCache())
   .CurrentSessionContext(IsInWebContext ? "managed_web" : "thread_static")
   .Mappings(c => c.FluentMappings.AddFromAssemblyOf<ProductMap>())          .BuildConfiguration();

Thank you all


--
______________________________________
Felipe B Oriani

Felipe Oriani

unread,
Feb 20, 2014, 12:29:14 PM2/20/14
to nhu...@googlegroups.com, fluent-n...@googlegroups.com
I found the problem, my app.config was wrong (hierarchy of nodes) and I do not know why nhibernate says the loggerProvider was not configured, it work back. Thanks
Reply all
Reply to author
Forward
0 new messages