4
votes

I'm trying to implement NHibernate into my Web App. I encounter an error which saying :

Method 'IsInstrumented' in type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory' from assembly 'NHibernate.ByteCode.Castle, Version=2.1.2.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' does not have an implementation.

Does anyone know how to resolve this issue?

1

1 Answers

5
votes

Make sure that you have following dlls copied to the output folder and loaded by w3wp.exe (if you use IIS):

  • NHibernate.ByteCode.Castle.dll
  • Castle.Core.dll
  • NHibernate.dll
  • Iesi.Collections.dll
  • log4net.dll

And your NHibernate configuration has this line:

<property name="proxyfactory.factory_class">
NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
</property>

As an option, you can try to upgrade to latest version of NHibernate - 3.2. They have a built in proxy generator so it should be simpler for you. You will not need these additional dlls. Just remove the config line above if you use NHibernate 3.2.

If for some reasons you can not upgrade to 3.2 you may consider using different 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