开发者

Error implementing NHibernate in an ASP.NET Website

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

Method 'IsI开发者_JAVA百科nstrumented' 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?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜