使用 Visual Studio 和 Visual Studio Code 构建 .NET 应用程序
基于专用 Exadata 基础设施的 Oracle Autonomous AI Database 支持连接到 Microsoft .NET Framework、.NET Core、Visual Studio 和 Visual Studio Code。
Oracle Data Provider for .NET (ODP.NET) 提供对自治 AI 数据库的运行时 ADO.NET 数据访问。ODP.NET 具有以下驱动程序类型:
-
.NET Framework 应用程序的非托管 ODP.NET
-
.NET Framework 应用程序的托管 ODP.NET
-
ODP.NET .NET Core 应用程序的核心
Oracle Developer Tools for Visual Studio 在 Visual Studio 中提供数据库应用设计时支持,包括用于在 Oracle Cloud 中管理 Autonomous AI Database 的工具。
Oracle Developer Tools for VS Code 在 Visual Studio Code 中提供数据库应用程序设计时支持。
这些软件组件可从以下站点免费下载:
- 托管 ODP.NET 和 ODP.NET 核心:NuGet 库
- 非托管 ODP.NET:Oracle Data Access Components 下载
- Oracle Developer Tools for Visual Studio Code: VS Code Marketplace
- Oracle Developer Tools for Visual Studio: Visual Studio Marketplace
Oracle 建议在 Autonomous AI Database 中使用新的提供商和工具版本。
设置说明
Refer to Developing .NET Applications for Oracle Autonomous AI Database for instructions on how to download, install, and configure these components for use with Oracle Autonomous AI Database on Dedicated Exadata Infrastructure.
请注意,这些说明显示了如何将 TCPS(TCP 和 SSL)连接到数据库,这需要使用钱包。对于专用基础结构上的数据库,您可以改为与数据库建立 TCP 连接,而无需使用 wallet。
要了解有关使用 Oracle Autonomous AI Database on Dedicated Exadata Infrastructure 和 .NET 的更多信息,请试用免费的 .NET Development with Oracle Autonomous AI Database Quick Start 。本练习将引导您完成在 Oracle Cloud Infrastructure 上设置连接到 Autonomous AI Database 的 .NET Web 服务器。接下来,该实验室将指导开发和部署使用所有这些组件的简单 ASP.NET Core Web 应用程序。到最后,您将在互联网上有一个实时的工作网站。
通过配置实现高可用性和高性能
在最新的 ODP.NET 版本中,快速连接故障转移 (Fast Connection Failover,FCF) 和连接运行时负载平衡 (Connection Runtime Load Balancing,RLB) 将通过连接字符串默认设置自动启用。FCF 需要连接字符串设置 "Pooling (true)" 和 "HA Events (true)。RLB 需要设置 "Pooling"(池)(真)和 "Load Balancing"(负载平衡)(真)。
应用程序连续性当前仅在非托管 ODP.NET 中可用。默认情况下,通过连接池设置 "Application Continuity (true)"(应用程序连续性)启用它。
对 ONS 连接使用 TCP 时,无需进行其他配置。
ONS TCPS 需要根据所使用的提供程序进行一些配置和代码更改:
-
ODP.NET 核心。要为 ODP.NET 核心配置 ONS TCPS,请使用 OracleConfiguration.OnsWalletLocation 启用 TPCS 并指明 wallet 位置。
OracleConfiguration.OnsWalletLocation = @"<wallet-directory>"; -
ODP.NET 托管驱动程序。要为托管 ODP.NET 配置 ONS TCPS,请修改类似于以下示例的 oracle.manageddataaccess.client 配置部分。
<oracle.manageddataaccess.client> <version number="*"> <onsConfig mode="remote"> <settings> <setting name="Protocol" value="TCPS" /> <setting name="WALLET_LOCATION" value="<wallet-directory>" /> </settings> <ons database="<database-name>"> <add name="nodeList" value="slcai611:6205,slcai610:6205,slcai612:6205" /> </ons> </onsConfig> <settings> <setting name="WALLET_LOCATION" value="<wallet-directory>" /> </settings> </version> </oracle.manageddataaccess.client> -
ODP.NET 非托管驱动程序。要为非托管 ODP.NET 配置 ONS TCPS,请修改类似于以下示例的 oracle.unmanageddataaccess.client 配置部分。
<oracle.unmanageddataaccess.client> <version number="*"> <onsConfig mode="remote"> <settings> <setting name="Protocol" value="TCPS" /> <setting name="WALLET_LOCATION" value="<wallet-directory>" /> </settings> <ons database="<database-name>"> <add name="nodeList" value="slcai611:6205,slcai610:6205,slcai612:6205" /> </ons> </onsConfig> <settings> <setting name="WALLET_LOCATION" value="<wallet-directory>" /> </settings> </version> </oracle.unmanageddataaccess.client>
相关主题