ODP.NET 和 ClickOnce 可能吗?

发布于 2024-07-29 13:04:54 字数 293 浏览 2 评论 0原文

我们有一个使用 ClickOnce 部署的 sqlserver (WinForms) 应用程序,可直接与数据库对话。 如果我们被迫将其移植到oracle,ODP.NET可以与ClickOnce一起使用吗?

(用户可能没有其 PC 上的管理员权限)

背景

此数据导入应用程序由每个客户站点上的少数用户使用,它使用集成登录来连接到 SQL Server。 大多数用户通过 Asp.net 应用程序或与 Web 服务通信的 WinForms (clickOnce) 应用程序来访问系统。

另请参阅“

We have a sqlserver (WinForms) application that is deployed with ClickOnce that talks directly to the database. If we are forced to port it to oracle, can ODP.NET be used with ClickOnce.

(The users may not have admin rights on their PCs)

Background

This data import application is used by a handful of users at each customer’s site it uses intergraded logon to connect to SQL Server. Most users access the system var an Asp.net application, or a WinForms (clickOnce) application that talks to a web service.

see also "How to write a .Net application that works with both SqlServer and Oracle "

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

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

发布评论

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

评论(4

谎言月老 2024-08-05 13:04:54

编辑:我已经修改了这个答案以实现现代化。 另外,需要澄清的是,ClickOnce 只是一个应用程序部署工具,如何在应用程序中使用 Oracle Client 和 ODP.Net 仍然由架构决定。 以下是最常见场景的摘要:

智能客户端应用程序(例如客户端应用程序 + Web 服务)

您的 ClickOnce 部署的客户端应用程序安装在用户的计算机上,但与某种服务进行交互以处理数据。 在这种情况下,您的客户端应用程序不需要分发 Oracle 客户端或 ODP.Net。

Oracle 客户端和 ODP.Net 包应通过 Oracle 的正常指令安装在托管后端服务的计算机上,并从该项目/应用程序中引用,就像使用/分发的任何其他库一样。

胖客户端“瘦部署”应用程序(例如 Citrix 上的“胖客户端”)

您的 ClickOnce 部署的客户端应用程序是“胖”的,因为它包含自己的数据层,因此必须能够通过本地安装的客户端连接到 Oracle ,并能够引用 ODP.Net 库。

在这种情况下,应使用 Oracle 的标准指令将 Oracle 客户端和 ODP.Net 包安装在托管计算机(例如 Citrix 盒子)上,并且您的应用程序应引用其托管计算机上安装的相应库。

胖客户端“胖部署”应用程序(例如用户计算机上的胖客户端)

在这种情况下,您的应用程序是典型的“胖客户端”,因为它有自己的数据层并且需要能够与 Oracle 客户端通信和 ODP.Net 库。

我们在这里讨论的特定场景是如何在您的应用程序中分发 Oracle Client 和 ODP.Net(例如,当您的用户没有在其计算机上安装这些产品时)。 以下是说明:

  1. 下载 Oracle Data Access组件包。

    (A) 当前版本是 ODAC 11.2 Release 4 (11.2.0.3),包括对 Microsoft Entity Framework 4 的支持。

    (B) 您需要安装 32 位版本的 ODP.Net,因为 Visual Studio 是 32 位应用程序。 然后,您可以在部署时编译为目标处理器和位版本。

  2. ODAC 包中包含 Oracle Instant Client 和 ODP.Net 库。 您需要将即时客户端库复制到您的应用程序并将它们设置为“始终复制”

  3. Reference Oracle.DataAccess.Client,就像任何其他库一样,然后设置 Copy Local = True.

  4. 您的连接字符串应该看起来很像 TNSNAMES.ORA 文件中的普通条目:

     数据源 =(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 主机名)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SID = oracle_world_here)));用户 ID= schema_here;密码=password_here;保留安全信息=TRUE; 
      

注释

A. 有两个主要版本的即时客户端 - 包含多语言支持的完整版本(约 115mb),以及仅支持英语的 Lite 版本(约 28mb)。

B.重要确保部署的库全部来自同一版本的客户端 - 这意味着如果您部署 32 位 ODP.Net,则必须部署 32 位即时客户端库。 如果您使用 11.2 即时客户端,则无法使用 11.0 ODP.Net 等 - 很愚蠢,但很多人都忽略了这一点; 使用良好的源代码控制。

C. 根据我的经验,以下库被放置在我的项目的根目录中(以避免权限或%PATH%的任何问题)

oci.dll,ociw32.dll,orannzsbb11.dll,oraocci11.dll,oraociicus11.dll,oraops11w。 dll


总结& 结果:

您现在可以对所有 Windows 客户端应用程序(胖、事物或智能)使用 ClickOnce 部署。

EDIT: I have revised this answer for modernization. Also, to clarify, ClickOnce is merely an application deployment tool, how to use Oracle Client and ODP.Net with your application is still determined by architecture. Here's a summary of the most common scenarios:

Smart Client Apps (ex. Client App + Web Service)

Your ClickOnce-deployed client application is installed on users' machines, but speaks to some sort of service to work with data. In this scenario, your client application does not need to distribute an Oracle Client or ODP.Net.

The Oracle Client and ODP.Net package should be installed via Oracle's normal instructions on the machine hosting the back-end service, and referenced from that project/application as any other library would be used/distributed.

Fat Client "Thin Deployment" Apps (ex. "fat client" on Citrix)

Your ClickOnce-deployed client application is "fat" in that it includes its own data layer, and therefore must be able to connect to Oracle via a locally installed client, and able to reference the ODP.Net libraries.

In this scenario, the Oracle Client and ODP.Net packages should be installed on the hosting machine (ex. Citrix box) using Oracle's standard instructions, and your application should reference the appropriate libraries installed on its hosting computer.

Fat Client "Fat Deployment" Apps (ex. fat-client on users' machines)

In this scenario, your application is a typical "fat client" in that it has its own data layer and needs to be able to communicate with the Oracle Client and ODP.Net libraries.

The particular scenario we're discussing here is how to distribute Oracle Client and ODP.Net within your application (ex. when your users do not have these products installed on their machines). Below are instructions:

  1. Download the Oracle Data Access Components package.

    (A) the current version is ODAC 11.2 Release 4 (11.2.0.3) and includes support for Microsoft Entity Framework 4.

    (B) You will need the 32-bit version of ODP.Net installed as Visual Studio is a 32-bit application. You can then compile to a target processor and bit version when you deploy.

  2. In the ODAC package are the Oracle Instant Client and ODP.Net libraries. You need to copy the instant client libraries to your application and set them to "Copy Always"

  3. Reference Oracle.DataAccess.Client like you would any other lib and set Copy Local = True.

  4. Your connection string should look much like a normal entry in a TNSNAMES.ORA file:

     Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SID = oracle_world_here)));User Id=schema_here;Password=password_here;Persist Security Info=TRUE;
    

Notes

A. There are two main versions of the instant client - the full version (approx. 115mb) which includes multiple language support, and the Lite version (approx. 28mb) with support for only English.

B. IMPORTANT Ensure the libraries deployed are all from the same version of the client - meaning if you deploy 32-bit ODP.Net you have to deploy 32-bit instant client libs. If you use 11.2 instant client, you cannot use 11.0 ODP.Net, etc. -- silly but lots of people overlook this; use good source control.

C. My experience, the following libraries were placed in the root of my project (to avoid any issues with permissions or %PATH%)

oci.dll, ociw32.dll, orannzsbb11.dll, oraocci11.dll, oraociicus11.dll, oraops11w.dll


Summary & Results:

You can now use ClickOnce deployments for all Windows Client applications - fat, thing, or smart.

浅紫色的梦幻 2024-08-05 13:04:54

Instant Client支持xcopy部署,所以方法相同(将它们包含在您的 ClickOnce 部署中)应该可以进行部署。

然而! 在许多情况下,使用“智能客户端”方法(使用 ClickOnce)可能更合适,即通过应用程序服务器通过 Web 服务进行数据访问。 那么客户端中就不需要任何 DAL 组件。

Instant Client supports xcopy deployment, so the same approach (including them in your ClickOnce deployment) should make it OK to deploy.

However! In many cases it may be more appropriate (with ClickOnce) to use a "smart client" approach, i.e. do the data access via an app-server via web-services. Then you don't need any DAL components in the client.

撧情箌佬 2024-08-05 13:04:54

XCOPY 部署是最接近 ODP.NET 一次点击部署的方式。

我刚刚回复了您的另一篇帖子,其中包含有关 XCOPY 部署的大量详细信息。

请看一下:

如何编写可与 SqlServer 和 Oracle 一起使用的 .Net 应用程序(现在 System.Data.OracleClient 已弃用)

Christian Shay
Oracle

编辑:Oracle 已宣布,他们将在 2011 年的某个时候发布 ODP.NET 提供程序(又名瘦客户端)的完全托管版本。 当这种情况发生时,ODP.NET 将不再依赖于任何其他文件,ClickOnce 部署将更加简单。

请随时在我们的功能请求网站上提供对此功能和其他未来功能的反馈:http://apex.oracle.com/pls/apex/f?p=18357:46

XCOPY deployment is the closest you are going to get to a click once deployment with ODP.NET.

I just replied to another one of your posts here will a lot of detail about XCOPY deployment.

Please have a look:

How to write a .Net application that works with both SqlServer and Oracle (now that System.Data.OracleClient is deprecated)

Christian Shay
Oracle

EDIT: Oracle has announced that sometime in 2011 they will release a fully managed version of the ODP.NET provider (aka thin client). When that happens there will be no dependency by ODP.NET on any other files and ClickOnce deployment will be simpler.

Feel free to provide your feedback on this and other future features at our feature request website: http://apex.oracle.com/pls/apex/f?p=18357:46

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