I am using Fluent NHibernate with the external file 'hibernate.cfg.xml'.
Below is the configuration code in which I get the error:
var configuration = new Configuration(); configuration.Configure(); _sessionFactory = Fluently.Configure(configuration) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Template>()) .BuildSessionFactory(); return _sessionFactory;
But when NHibernate tries to configure, I get an error while posting:
An exception occurred while setting the save level.
An internal exception says:
ProxyFactoryFactory has not been configured. Initialize the proxyfactory.factory_class property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
I googled and, according to some solutions that I found, I made the following changes:
Add the following DLLs to my application box:
Castle .Core.dll, Castle.DynamicProxy2.dll, NHibernate.ByteCode.Castle.dll
Added follwing property in hibernate.cfg.xml
<property name = "proxyfactory.factory_class"> NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle </property>
But still I get the same exception.
c # nhibernate configuration fluent-nhibernate
iniki
source share