Question

I am trying to connect to an Oracle Database using nHibernate. I can connect using the .Net driver:

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

However I would prefer to use the OracleDataClientDriver that ships with Oracle (or nHibernate? I forget). Anyway I was using the instructions of this blog:

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

All is fine but when I add the app.config with the following setting to my Unit Test class:

<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>

And attempt to run my test I get the following error:

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()

Any advice? Edit: I have added the Test Driven assemblies to the GAC and now am getting a different error:

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.

Which is the same error that it meant to be addressed in the App.Config. The Oracle.DataAccess has been added to the GAC and I have also tried it in the application folder. Yet error still appears.

Was it helpful?

Solution

I don't see any references to Oracle (or NHibernate) in that error.

In any case, I recommend you upgrade to NH 3.0 Alpha2. The assemblyBinding stuff isn't needed anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top