We recently upgraded our Windows C # projects from NHibernate 2.0 to 2.1. We updated our app.config to include "proxyfactory.factory_class" to point to the selected proxy ("NHibernate.ByteCode.Castle" in our case). After the update, the program builds and works as expected, without problems. Our problem is trying to open any forms that contain links to NHibernate when loading in the designer of Visual Studio 2008, now gives us the following error (as if we had not configured the proxy):
ProxyFactoryFactory has not been configured. initialize the "proxyfactory.factory_class" property of the factory session configuration with one of the available NHibernate.ByteCode Providers.
Stack trace:
at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory() at NHibernate.Cfg.Configuration.Validate() at NHibernate.Cfg.Configuration.BuildSessionFactory() at DAL.NHibernateHelper..cctor() in ...\DAL\NHibernateHelper.cs:line 62
Line 62 of NHibernateHelper:
static NHibernateHelper() { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly("DAL"); sessionFactory = cfg.BuildSessionFactory();
Here is our app.config configuration for NHibernate:
<configuration> <configSections> <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> </configSections> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property> <property name="connection.connection_string">Server=ourserver;initial catalog=ourdb;Integrated Security=SSPI</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> <property name="show_sql">true</property> </session-factory> </hibernate-configuration> </configuration>
Does anyone know how to fix this problem? Thanks!
source share