简体   繁体   English

ODP.NET适用于32位和64位

[英]ODP.NET for both 32bit and 64bit

I am developing application which uses ODP.NET to connect to Oracle DB. 我正在开发使用ODP.NET连接到Oracle DB的应用程序。 I would like to have one version for both 32bit and 64bit machines. 我想为32位和64位机器提供一个版本。 The problem is that I couldn't figure out how to build projetc with anycpu target, seems it requires the target to be the same as ODP driver version. 问题是我无法弄清楚如何使用anycpu目标构建projetc,似乎它要求目标与ODP驱动程序版本相同。 So it means that I need to have to versions of the same application one for 32bit and other for 64bit. 因此,这意味着我需要同一个应用程序的版本,一个用于32位,另一个用于64位。 But the same was not problem while using MS .NET Oracle client (System.Data.OracleClient). 但使用MS .NET Oracle客户端(System.Data.OracleClient)时同样没问题。 Is there a way to have the same behavior using ODP.NET as on MS .NET client? 有没有办法在MS .NET客户端上使用ODP.NET具有相同的行为?

Just update few years later: Oracle released managed ODP.NET client, so there's no need to bother with x64/x86 in .NET applications any more. 几年后更新:Oracle发布了托管的ODP.NET客户端,因此不再需要在.NET应用程序中使用x64 / x86。 You can find more information on Oracle website: http://www.oracle.com/technetwork/topics/dotnet/index-085163.html 您可以在Oracle网站上找到更多信息: http//www.oracle.com/technetwork/topics/dotnet/index-085163.html

The root cause is the ODP.NET's reliance on native OCI DLLs , which of course cannot be "Any CPU". 根本原因是ODP.NET依赖于本机 OCI DLL ,当然这不是“任何CPU”。

Theoretically, ODP.NET could detect the "bit-ness" of the current execution in the .NET code and then dynamically load either 32-bit or 64-bit native DLLs accordingly, but that's not how it is currently implemented. 从理论上讲,ODP.NET可以检测.NET代码中当前执行的“bit-ness”,然后相应地动态加载32位或64位本机DLL,但这不是当前实现的方式。

Oracle corporation is currently in the process of implementing a fully managed provider . Oracle公司目前正在实施完全托管的提供商 But until then , we are stuck with having to do separate builds for each "bit-ness". 在那之前 ,我们不得不为每个“bit-ness”做单独的构建。

The default option for any C# project is it will work on both x64 and x86 operating systems. 任何C#项目的默认选项是它可以在x64和x86操作系统上运行。

So it means that I need to have to versions of the same application one for 32bit and other for 64bit. 因此,这意味着我需要同一个应用程序的版本,一个用于32位,另一个用于64位。 But the same was not problem while using MS .NET Oracle client (System.Data.OracleClient). 但使用MS .NET Oracle客户端(System.Data.OracleClient)时同样没问题。

This is expected....You need to release a x86 version and a x64 version, please take note, x86 application cannot reference a x64 assembly and vice-versa. 这是预期的....你需要发布一个x86版本和一个x64版本,请注意,x86应用程序不能引用x64程序集,反之亦然。

The reason the Microsoft reference was different was because its part of the .NET Framework by default. Microsoft引用不同的原因是默认情况下它是.NET Framework的一部分。

I cannot download the file where I am at, I do believe that, ODP.NET has a x86 assembly and a x64 assembly. 我无法下载我所在的文件,我相信,ODP.NET有一个x86程序集和一个x64程序集。

The correct way is to release a x86 version and a x64 version of your program. 正确的方法是发布程序的x86版本和x64版本。

ODP.NET is specifically built for either 32-bit or 64-bit platform. ODP.NET专为32位或64位平台而构建。 They could have built a single library for AnyCPU which would allow it to be used in a 32-bit or 64-bit process. 他们可以为AnyCPU构建一个单独的库,允许它在32位或64位进程中使用。 However, as Branko Dimitrijevic alluded to, the ODP.NET managed dll uses native libraries behind the scenes. 然而,正如Branko Dimitrijevic所提到的,ODP.NET托管的dll在幕后使用本机库。 Native libraries are platform-specific; 本机库是特定于平台的; thus requiring Oracle to build separate ODP.NET library for each platform. 因此要求Oracle为每个平台构建单独的ODP.NET库。 There is no alternative. 没有替代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM