2010-08-26 79 views
0

我正嘗試使用nHibernate連接到Oracle數據庫。我可以連接使用.net司機:將nHibernate連接到Oracle問題

<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property> 

不過我更願意使用OracleDataClientDriver附帶甲骨文(或NHibernate的我忘了?)。反正我是用這個博客的說明:

http://tiredblogger.wordpress.com/2008/11/07/using-oracle-odp-with-nhibernate-from-a-c-class-library/

一切都很好,但是當我用下面的設置添加在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中,我也在應用程序文件夾中嘗試過。但仍然出現錯誤。

+0

您是否擁有GAC中的TestDriven程序集? – Jerome 2010-08-26 11:33:22

+0

不,現在是。我得到另一個錯誤。 – Damien 2010-08-26 13:34:26

+0

你有沒有在機器上安裝完整的oracle客戶端東西?這是一個正確的皇家痛苦,當我上次使用它時,我想我最終在MS驅動程序中解決了blob問題,因爲Oracle是不可靠的(隨機錯誤難以重現,即使不是不可能)。 – 2010-08-27 13:31:08

回答

0

我在該錯誤中沒有看到對Oracle(或NHibernate)的任何引用。

無論如何,我建議您升級到NH 3.0 Alpha2。 AssemblyBinding的東西不再需要了。

+0

進一步進步,得到不同的錯誤。 – Damien 2010-08-26 13:34:41