我正尝试使用nHibernate连接到Oracle数据库。我可以连接使用.net司机:将nHibernate连接到Oracle问题
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
不过我更愿意使用OracleDataClientDriver附带甲骨文(或NHibernate的我忘了?)。反正我是用这个博客的说明:
一切都很好,但是当我用下面的设置添加在app.config到我的单元测试类:
<runtime>
<assemblyBinding xmlns=“urn:schemas-microsoft-com:asm.v1“>
<qualifyAssembly partialName=“Oracle.DataAccess“
fullName=“Oracle.DataAccess,
Version=2.111.6.20,
Culture=neutral,
PublicKeyToken=89b483f429c47342“ />
</assemblyBinding>
</runtime>
,并尝试运行我的测试我得到以下错误:
Test 'M:UTOracleImporter.UT_SchemaDAO.Test_GetCustomer' failed: Could not load type 'TestDriven.Framework.Resident.IResidentTestRunner' from assembly 'TestDriven.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=50ecb853f8c6b8d2'.
System.TypeLoadException: Could not load type 'TestDriven.Framework.Resident.IResidentTestRunner' from assembly 'TestDriven.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=50ecb853f8c6b8d2'.
at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()
有什么建议吗? 编辑:我已经添加了测试驱动组件到GAC,现在我得到一个不同的错误:
NHibernate.HibernateException : The IDbCommand and IDbConnection implementation in the assembly Oracle.DataAccess could not be found. Ensure that the assembly Oracle.DataAccess is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly.
这是同样的错误,这意味着在App.config加以解决。 Oracle.DataAccess已被添加到GAC中,我也在应用程序文件夹中尝试过。但仍然出现错误。
您是否拥有GAC中的TestDriven程序集? – Jerome 2010-08-26 11:33:22
不,现在是。我得到另一个错误。 – Damien 2010-08-26 13:34:26
你有没有在机器上安装完整的oracle客户端东西?这是一个正确的皇家痛苦,当我上次使用它时,我想我最终在MS驱动程序中解决了blob问题,因为Oracle是不可靠的(随机错误难以重现,即使不是不可能)。 – 2010-08-27 13:31:08