Sunday, April 3, 2011

NHibernate configuration ProxyFactoryFactory exception

This is how my configuration file look like.

< configSections >
< section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" / >
< /configSections >

< hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
< session-factory name="EClinic" >
< property name="connection.provider" >NHibernate.Connection.DriverConnectionProvider< /property >
< property name="connection.driver_class" >NHibernate.Driver.SqlClientDriver< /property >
< property name="connection.connection_string" >Server=(arindam123);initial catalog=mydatabasename;userid=username;password=mypass;Integrated Security=SSPI; < /property >
< property name="dialect" >NHibernate.Dialect.MsSql2005Dialect< /property >
< property name="proxyfactory.factory_class" >NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle< /property >
< property name="show_sql" >true< /property >
< /session-factory >
< /hibernate-configuration >
< /configSections >


I am getting following error
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
Example:
NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException: The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
Example:
NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle

Source Error:


Line 20: log4net.Config.XmlConfigurator.Configure();
Line 21: Configuration cfg = new Configuration();
Line 22: m_sessionFactory = cfg.BuildSessionFactory();
Line 23:
Line 24: }

No comments: