【发布时间】:2009-12-16 09:45:06
【问题描述】:
我一直在尝试运行一个简单的 NHibernate 应用程序。我正在一步一步地做“NHibernate 入门”。 首先,我得到了一个无效的属性错误(设法解决了这个问题)。
现在,我遇到了一个异常:
无法加载类型“NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle” 在代理工厂类的配置过程中。
可能的原因有: - 未部署 NHibernate.Bytecode 提供程序程序集。 - 用于初始化 session-factory 部分的 'proxyfactory.factory_class' 属性的 typeName 格式不正确。
解决方案: 确认您的部署文件夹包含以下程序集之一: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll"
提到的文件在 QuickStart.dll 所在的 Bin 文件夹中。 我不知道为什么会这样! 我今天花了几个小时试图让它发挥作用。 SO (Unable to load type ‘NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu’) 的问题没有帮助:(
来自 Web.config 的休眠配置:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=(local);initial catalog=quickstart;Integrated Security=SSPI</property>
<property name="connection.isolation">ReadCommitted</property>
<property name="default_schema">Monitor.dbo</property>
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<!-- HBM Mapping Files -->
<mapping assembly="QuickStart"/>
</session-factory>
</hibernate-configuration>
【问题讨论】:
标签: nhibernate exception visual-studio-2005 proxy