nHibernate 到 Oracle 的连接问题

发布于 2024-09-16 06:05:46 字数 2103 浏览 3 评论 0原文

我正在尝试使用 nHibernate 连接到 Oracle 数据库。我可以使用 .Net 驱动程序进行连接:

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

但是我更喜欢使用 Oracle 附带的 OracleDataClientDriver(或 nHibernate?我忘了)。无论如何,我正在使用此博客的说明:

http://tiredblogger.wordpress.com/2008/11/07/using-oracle-odp-with-nhibernate-from-ac-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: IDbCommand 和 IDbConnection 在议会中实施 无法找到 Oracle.DataAccess。 确保装配 Oracle.DataAccess 位于 应用程序目录或全局 程序集缓存。如果装配体位于 GAC,使用 应用程序中的元素 配置文件指定完整的 程序集的名称。

这与要在 App.Config 中解决的错误相同。 Oracle.DataAccess已添加到GAC中,我也在应用程序文件夹中尝试过。但仍然出现错误。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裸钻 2024-09-23 06:05:46

我在该错误中没有看到任何对 Oracle(或 NHibernate)的引用。

无论如何,我建议您升级到NH 3.0 Alpha2。不再需要 assemblyBinding 的东西了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文