开发者

FluentConfigurationException was unhandled

开发者 https://www.devze.com 2023-04-04 04:44 出处:网络
FluentConfigurationException was unhandled An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

FluentConfigurationException was unhandled

An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

My SessionFactory method:

_sessionFactory = Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008 // 
                              .ConnectionString(@"Server=.\SQLExpress;Database=testdb1;Uid=dev;Pwd=123;"))
                .Mappings(m => m.FluentMappings
                                   .AddFromAssemblyOf<User>())
                .ExposeConfiguration(cfg => new SchemaExport(cfg)
                                      开发者_如何学Python          .Create(true, true))
                .BuildSessionFactory();

The inner exception is:

Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.

Possible causes are:

  • The NHibernate.Bytecode provider assembly was not deployed.

  • The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

Solution:

Confirm that your deployment folder contains one of the following assemblies:

NHibernate.ByteCode.LinFu.dll

NHibernate.ByteCode.Castle.dll

I am testing things out in a console application. My console app references my Data project that has all my nhibernate entities/mappings and sessionfactory code.

The Data project has the following in the /bin/debug folder:

Castle.core.dll, FluentNHibernate.dll, Iesi.COllection.dll, NHibernate.ByteCode.Castle.dll, NHibernate.dll

I downloaded all my .dll's from http://fluentnhibernate.org/ today (so it's fluent 1.2 using nhibernate 3.1)


I think you have to add a reference to NHibernate.ByteCode.Castle.dll to your console app.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号