c# Castle.ActiveRecord ORM框架升级(.net2.0至.net4.0)

dll相关

dll版本信息

NHibernate相关的用3.1.0.4000版本
Castle.ActiveRecord相关用3.0.0.0版本
Castle.Windsor相关用2.5.2.0版本

关于合并dll

Castle.Core.dll(2.5.2.0)包含Castle.DynamicProxy.dll、Castle.DynamicProxy2.dll(根据官方说明在版本2.5之后原先独立的castle.dynamicproxy.dll)
Castle.Windsor.dll(2.5.2.0)包含Castle.MicroKernel.dll

需要更改的using

using NHibernate.Expression;换为using NHibernate.Criterion;

错误处理

A00
错误:初始化Castle.ActiveRecord的时候“Castle.ActiveRecord.Framework.ActiveRecordException”
处理:可能是NHibernate版本的问题,如果在配置文件可以尝试如下更改


 

A01
错误:提示“XXXXXXXXXXXXXXXXXXXX”的类型初始值设定项引发异常。(建立容器类)
处理:考虑版本兼容问题,尝试换Castle.Windsor/Castle.MicroKernel dll版本
A02
错误:Unable to load type ' NHibernate.Bytecode.DefaultProxyFactoryFactory,NHibernate.ByteCode.Castle' 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
处理:加NHibernate.ByteCode.LinFu.dll、NHibernate.ByteCode.Castle.dll,加
web.config



    
         
            
            
            
            
            
        
    

A03
错误:

ERROR - Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' 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
Path And Query: /handler/SystemHandler.ashx
Request Type: POST
Http Referrer: /
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
IP Address: ::1
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' 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.FileLoadException: 未能加载文件或程序集“NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)  

处理:考虑引用版本是不是你下的那个版本,可以尝试删掉NHibernate相关引用再重新应用(ps:我是因为下的NHibernate-3.1.0.GA-src自己编译的dll,过了一天以后开始报错,换成NHibernate-3.1.0.GA-bin里面的dll后就没得问题了)
A04
错误:“((NHibernate.Impl.SessionImpl)session).Connection”引发了类型“System.Data.OracleClient.OracleException”的异常
详细描述:我有很多个表,id都是用的获取序列号,就其中一个表调用下面这个代码时报上面那个错误(session的Connection获取不了),其它时候调用都没问题。
处理:尚未解决

所用dll文件下载

上述dll下载于:
1.https://sourceforge.net/projects/castleproject/files/
2.https://master.dl.sourceforge.net/project/nhibernate/NHibernate/3.1.0.GA/NHibernate-3.1.0.GA-bin.zip
3.http://logging.apache.org/log4net/download_log4net.cgi

你可能感兴趣的:(c# Castle.ActiveRecord ORM框架升级(.net2.0至.net4.0))