部署和配置ODP.NET工作,无需安装实体框架 [英] Deploying and Configuring ODP.NET to work without installation with Entity Framework

查看:1441
本文介绍了部署和配置ODP.NET工作,无需安装实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何部署和配置ODP.NET,无需使用Entity Framework进行安装?

How do you deploy and configure ODP.NET to work without installation with Entity Framework?

A。如何部署和配置Oracle.DataAccess.Client?

A. How to deploy and configure Oracle.DataAccess.Client?

B。如何部署和配置Oracle.ManagedDataAccess.Client?

B. How to deploy and configure Oracle.ManagedDataAccess.Client?

C。您需要做什么才能使用Oracle SSDLs的EDMX进行构建?

C. What do you need to do in order to make builds with EDMXs with Oracle SSDLs work?

D。

推荐答案

此答案总结(希望)所有必需的步骤,其中许多记录在线的各种地方,可能会节省一些时间的谷歌。

This answer summarizes (hopefully) all the steps required, many of which documented in various places online and might save someone hours of Googling.

A。如何部署和配置Oracle.DataAccess.Client。

A. How to deploy and configure Oracle.DataAccess.Client.

A.1。下载 ODAC112030Xcopy_64bit.zip ODAC112030Xcopy_32bit.zip

A.1.1。将zip文件中的以下文件夹的内容提取到应用程序/主机的bin / setup文件夹中:

A.1.1. Extract the content of the following folders within the zip file into your application/host's bin/setup folder:

A.1.1.1。 instantclient_11_2

A.1.1.1. instantclient_11_2

A.1.1.2。 odp.net4\bin\

A.1.1.2. odp.net4\bin\

A.1.1.3。 odp.net4\odp.net\bin\

A.1.1.3. odp.net4\odp.net\bin\

A.1.1.4。 odp.net4\odp.net\PublisherPolicy\4\

A.1.1.4. odp.net4\odp.net\PublisherPolicy\4\

A.2。将以下部分添加到应用程序的/ host的app.config / web.config的开头(如果您已经有一个configSections元素,请添加该部分:

A.2. Add the following section to the beginning of your application's/host's app.config/web.config (if you already have a configSections element, add the section to it:

<configSections>
  <section name="oracle.dataaccess.client"
    type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

A.3。将以下部分添加到应用程序/主机的app.config / web.config的末尾:

A.3. Add the following sections to the end of your application's/host's app.config/web.config:

A。 4.从ODAC112030Xcopy的文件夹运行:

A.4. From the ODAC112030Xcopy's folder Run:

configure.bat odp.net4 somename

我建议使用oraclehome112030_32或oraclehome112030_64作为上面的somename。

I recommend using oraclehome112030_32 or oraclehome112030_64 as the "somename" above.

<system.data>
  <DbProviderFactories>
    <!-- Remove in case this is already defined in machine.config -->
    <remove invariant="Oracle.DataAccess.Client" />
    <add name="Oracle Data Provider for .NET"
         invariant="Oracle.DataAccess.Client"
         description="Oracle Data Provider for .NET"
         type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
  </DbProviderFactories>
</system.data>

<oracle.dataaccess.client>
  <settings>
    <add name="bool" value="edmmapping number(1,0)" />
    <add name="byte" value="edmmapping number(3,0)" />
    <add name="int16" value="edmmapping number(5,0)" />
    <add name="int32" value="edmmapping number(10,0)" />
    <add name="int64" value="edmmapping number(19,0)" />
    <add name="int16" value="edmmapping number(38,0)" />
    <add name="int32" value="edmmapping number(38,0)" />
    <add name="int64" value="edmmapping number(38,0)" />
  </settings>
</oracle.dataaccess.client>









B。如何部署和配置Oracle.ManagedDataAccess.Client。

B. How to deploy and configure Oracle.ManagedDataAccess.Client.

B.1。下载 ODP.NET_Managed_1120350_Beta.zip

B.1.1。将以下文件解压缩到应用程序/主机的bin / setup文件夹中。

B.1.1. Extract the following files into your application/host's bin/setup folder.

B.1.1.1。 Oracle.ManagedDataAccess.dll

B.1.1.1. Oracle.ManagedDataAccess.dll

B.1.1.2。 x64 \Oracle.ManagedDataAccessDTC.dll或x86 \Oracle.ManagedDataAccessDTC.dll

B.1.1.2. x64\Oracle.ManagedDataAccessDTC.dll or x86\Oracle.ManagedDataAccessDTC.dll

B.2。将以下部分添加到应用程序的/ host的app.config / web.config的开头(如果您已经有一个configSections元素,请添加该部分:

B.2. Add the following section to the beginning of your application's/host's app.config/web.config (if you already have a configSections element, add the section to it:

<configSections>
  <section name="oracle.manageddataaccess.client"
    type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.112.3.50, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>

B.3。将以下部分添加到应用程序/主机的app.config / web.config的末尾:

B.3. Add the following sections to the end of your application's/host's app.config/web.config:

<system.data>
  <DbProviderFactories>
    <!-- Remove in case this is already defined in machine.config -->
    <remove invariant="Oracle.ManagedDataAccess.Client" />
    <add name="ODP.NET, Managed Driver"
         invariant="Oracle.ManagedDataAccess.Client"
         description="Oracle Data Provider for .NET, Managed Driver"
         type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.112.3.50, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </DbProviderFactories>
</system.data>

<oracle.manageddataaccess.client>
  <version number="*">
    <settings>
      <!-- Set this path if you are using TNS aliases as connection strings (not recommended) -->
      <!-- Instead you can use "SERVER_NAME:PORT/SERVICE_NAME" as your data source -->
      <setting name="TNS_ADMIN" value="C:\"/>
    </settings>
    <edmMappings>
      <edmMapping dataType="number">
        <add name="bool" precision="1"/>
        <add name="byte" precision="2" />
        <add name="int16" precision="5" />
      </edmMapping>
    </edmMappings>
  </version>
</oracle.manageddataaccess.client>









C。建筑物:

C.1。将此部分添加到您的EDMX程序集的app.config中:

C.1. Add this section to your EDMX's assembly's app.config:

(尚未尝试使用Oracle。 Managed DataAccess.Client) p>

(Haven't tried this with Oracle.ManagedDataAccess.Client yet)

<oracle.dataaccess.client>
  <settings>
    <add name="bool" value="edmmapping number(1,0)" />
    <add name="byte" value="edmmapping number(3,0)" />
    <add name="int16" value="edmmapping number(5,0)" />
    <add name="int32" value="edmmapping number(10,0)" />
    <add name="int64" value="edmmapping number(19,0)" />
    <add name="int16" value="edmmapping number(38,0)" />
    <add name="int32" value="edmmapping number(38,0)" />
    <add name="int64" value="edmmapping number(38,0)" />
  </settings>
</oracle.dataaccess.client>

C.2。将一个名为Oracle.xsd的文件添加到具有以下内容的同一程序集中:

C.2. Add a file named Oracle.xsd to the same assembly with the content:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="odpnetappconfigmappings" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="addtype">
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="value" type="xs:string" />
  </xs:complexType>

  <xs:complexType name="settingstype">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="add" type="addtype" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="oracledataaccessclienttype">
    <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element name="settings" type="settingstype" />
    </xs:sequence>
  </xs:complexType>

  <xs:element name="oracle.dataaccess.client" type="oracledataaccessclienttype" />

</xs:schema>

C.3。将上述XSD添加到上述app.config的Schemas列表中。

C.3. Add the above XSD to the above app.config's list of Schemas.

C.4。如果您在构建过程中遇到布尔映射错误,即使构建成功,请将app.config映射添加到Visual Studio的devenv.exe.config。

C.4. If you are getting errors for boolean mappings during build even though build is succeeding, add the app.config mappings to Visual Studio's devenv.exe.config.

C.5。如果要使用Oracle.ManagedDataAccess.Client,请在构建之前手动编辑EDMX中的数据提供程序属性(我没有尝试过)或在运行时创建Context之前对其进行编辑,并从编辑的副本加载MSSL,而不是从资源(这似乎工作,我也使用类似的技巧来选择为不同的DB提供商加载哪个MSSL)。

C.5. If you want to use Oracle.ManagedDataAccess.Client, either edit data provider attribute in the EDMX manually prior to build (I have not tried this) or edit it prior to creation of Context at run time and load MSSL from edited copy instead of from resource (this seems to work and I also use a similar trick to choose which MSSL to load for different DB providers).









D。对于设计师支持:

D. For designer support:

D.1。下载 win64_11gR2_client.zip win32_11gR2_client.zip 并安装。

D.1. Download win64_11gR2_client.zip or win32_11gR2_client.zip and install.

D.1.1。选择管理员作为安装类型。

D.1.1. Select "Administrator" as type of installation.

D.2。 下载ODT 并安装。









我试过这个(A和B)一个带有Windows 7 x64的空白机器(VM)。

I tried this (A and B) on a blank machine (VM) with Windows 7 x64.

此过程似乎不适用于Windows x64上的x86版本的Oracle.DataAccess.Client。

This procedure does not seem to work with x86 version of Oracle.DataAccess.Client on Windows x64.

该过程似乎适用于Windows x64上的x.DataAccess.Client版本,以及两个版本的Oracle.ManagedDataAccess.Client。

The procedure does seem to work with the x64 version of Oracle.DataAccess.Client on Windows x64 and with both versions of Oracle.ManagedDataAccess.Client.

这篇关于部署和配置ODP.NET工作,无需安装实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆