NHibernate版本升级到2.12

NHibernate以前用的是2.0版的,据说新的NHibernate 2.12需要.net 2.0 sp1以上,才能支持。

更改dll后,报如下错误

代码
The ProxyFactoryFactory was not configured.
Initialize 
'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException: The ProxyFactoryFactory was not configured.
Initialize 
'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

其中<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> 这个没有配置,<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>这个应该是新版本才有的,以前没有看到过。LinFu倒是像中国拼音。

 

在 hibernate.cfg.xml添加<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> ,引用加上NHibernate-2.1.2.GA-bin\Required_For_LazyLoading\Castle\NHibernate.ByteCode.Castle.dll这个dll,又报Castle.DynamicProxy2.dll没找到,继续引用加上,问题解决。

 

如果按<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>这个配置,只需要添加 NHibernate-2.1.2.GA-bin\Required_For_LazyLoading\LinFu\NHibernate.ByteCode.LinFu.dll这个dll,问题就解决了。

 

两者选其一即可。

 

以前的映射类和.hbm.xml文件无需修改,直接可以用。

 

 

 

 

 

posted @ 2009-12-19 16:40  无色  阅读(1009)  评论(1编辑  收藏  举报