oracle 无法加载类型 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3971544/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:43:55  来源:igfitidea点击:

Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle'

c#oraclenhibernatehibernate

提问by Pedro Dusso

Well,

好,

As I read and try every topic similar without success, I decided to post my own question. My solution has a console app and a class library for dataaccess. The Nhibernate configuration is inside the appconfig in the console app (which I'm currently using for debug, as I will after make a Web App and migrate all configuration to web.config).

当我阅读并尝试每个类似的主题但没有成功时,我决定发布我自己的问题。我的解决方案有一个控制台应用程序和一个用于数据访问的类库。Nhibernate 配置位于控制台应用程序中的 appconfig 内(我目前正在使用它进行调试,因为我会在创建一个 Web 应用程序并将所有配置迁移到 web.config 之后)。

The exception is well know:

例外是众所周知的:

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle.dll' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed. Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.IO.FileNotFoundException: Could not load file or assembly 'NHibernate.ByteCode.Castle.dll' or one of its dependencies. The system cannot find the file specified.

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle.dll' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed. Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.IO.FileNotFoundException: Could not load file or assembly 'NHibernate.ByteCode.Castle.dll' or one of its dependencies. The system cannot find the file specified.

The steps I took to try to solve it:

我试图解决它的步骤:

1) The dll in the deployment folder - I have the following dll in my bin:
Antlr3.Runtime.dll - v. 3.1.3.42154
Castle.Core.dll - v. 2.5.1.2121
Castle.DynamicProxy2.dll - v. 2.2.0.6628
Iesi.Collections.dll - v.3.0.0.1002
log4net.dll - v. 1.2.10.0
NHibernate.ByteCode.Castle.dll - v.3.0.0.2001NHibernate.dll - v.3.0.0.1002
Oracle.DataAccess.dll - v.4.112.1.2
Remotion.Data.Linq.dll - v.1.13.41.2

1) 部署文件夹中的 dll - 我的 bin 中有以下 dll:
Antlr3.Runtime.dll - v. 3.1.3.42154
Castle.Core.dll - v. 2.5.1.2121
Castle.DynamicProxy2.dll - v. 2.2。 0.6628
Iesi.Collections.dll - v.3.0.0.1002
log4net.dll - v 1.2.10.0
NHibernate.ByteCode.Castle.dll - v.3.0.0.2001NHibernate.dll - v.3.0.0.1002
Oracle.DataAccess.dll - v .4.112.1.2
Remotion.Data.Linq.dll - v.1.13.41.2

2) The configuration in configuration block

2)配置块中的配置

 <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
  <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
  <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
  <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
  <property name="connection.connection_string_name">MetaManager</property>
  <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle</property>
  <mapping assembly="MetaManager.Data"/>
</session-factory>

3) I set my MetaManager.Data project to deploy in a x86 CPU
4) All dll in my bin folder are referenced in the project.

3) 我将我的 MetaManager.Data 项目设置为在 x86 CPU 中部署
4) 我的 bin 文件夹中的所有 dll 都在项目中被引用。

I think this it it. I do not know were else to go :(

我想这就是它。我不知道还有什么可以去的:(

Pedro Dusso

佩德罗·杜索

updates in bold

粗体更新

回答by Pieter van Ginkel

I think you have the wrong Castle version. You should be having Castle.Core.dll. NHibernate.ByteCode.Castle.dll probably isn't loaded because it cannot find Castle.Core.dll.

我认为你有错误的城堡版本。你应该有 Castle.Core.dll。NHibernate.ByteCode.Castle.dll 可能没有加载,因为它找不到 Castle.Core.dll。

In the download from http://sourceforge.net/projects/nhibernate/files/NHibernate/3.0.0Beta1/, the files located in \Required_For_LazyLoading\Castle are the files you need.

http://sourceforge.net/projects/nhibernate/files/NHibernate/3.0.0Beta1/的下载中,位于 \Required_For_LazyLoading\Castle 的文件就是您需要的文件。