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

时间:2010-10-19 18:40:40

标签: c# oracle nhibernate hibernate

那么,

当我阅读并尝试类似的每个主题都没有成功时,我决定发表自己的问题。 我的解决方案有一个控制台应用程序和一个用于dataaccess的类库。 Nhibernate配置位于控制台应用程序中的appconfig内部(我目前正用于调试,因为我将创建一个Web应用程序并将所有配置迁移到web.config)。

众所周知例外:

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.

我试图解决它的步骤:

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.2001 NHibernate.dll - v.3.0.0.1002
Oracle.DataAccess.dll - v.4.112.1.2
Remotion.Data.Linq.dll - v.1.13.41.2

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)我将MetaManager.Data项目设置为部署在x86 CPU中 4)项目中引用了我的bin文件夹中的所有dll。

我认为这就是它。我不知道还有其他事情要去:(

Pedro Dusso

粗体

更新

1 个答案:

答案 0 :(得分:7)

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

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