Make sure that you have the following DLL files copied to the output folder and loaded using w3wp.exe (if you are using IIS):
- NHibernate.ByteCode.Castle.dll
- Castle.Core.dll
- NHibernate.dll
- Iesi.Collections.dll
- log4net.dll
And your NHibernate configuration has the following line:
<property name="proxyfactory.factory_class"> NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle </property>
As an option, you can try upgrading to the latest version of NHibernate - 3.2. They have a built-in proxy generator, so it should be easier for you. You do not need these additional DLLs. Just delete the configuration line above if you are using NHibernate 3.2.
If for some reason you cannot upgrade to 3.2, you can consider using byte code providers . NHibernate supports 3 of them out of the box. Try LinFu or Spring:
NHibernate.ByteCode.Castle.ProxyFactoryFactory- NHibernate.ByteCode.LinFu.ProxyFactoryFactory
- NHibernate.ByteCode.Spring.ProxyFactoryFactor
source share