oracle ODAC 12c 和实体框架 6

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19498766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:01:32  来源:igfitidea点击:

ODAC 12c and Entity Framework 6

c#oracleentity-frameworkentity-framework-6odac

提问by philreed

Can anyone tell me if the Oracle Data Access Components 12cis compatible with Entity Framework 6? The Oracle website is a nightmare for documentation and cannot find any references on how to resolve this.

谁能告诉我Oracle Data Access Components 12c是否与 Entity Framework 6 兼容?Oracle 网站是文档的噩梦,无法找到有关如何解决此问题的任何参考资料。

I have an existing project which I am trying to upgrade to ODAC 12c and EF6 but I'm getting the following error which I am struggling to resolve:

我有一个现有项目,我正在尝试将其升级到 ODAC 12c 和 EF6,但出现以下错误,我正在努力解决:

exception

例外

I created a fresh project to rule out any issues with my existing project and I get the same problem. I believe it to be an issue with the app.config file edited automatically by the Entity Framework Power Tools Beta 4(Reverse Engineer Code First):

我创建了一个新项目来排除现有项目的任何问题,但我遇到了同样的问题。我认为这是Entity Framework Power Tools Beta 4(逆向工程师代码优先)自动编辑的 app.config 文件的问题:

config file

配置文件

Can anyone point me in the right direction?

任何人都可以指出我正确的方向吗?

采纳答案by Badreddine Bmg

**Oracle Data Access Components 12c Release 3 Beta 2 ** ODAC 12c R3 is the first ODP.NET release to certify with Entity Framework (EF) 6 and EF Code First. http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html

**Oracle 数据访问组件 12c 第 3 版 Beta 2 ** ODAC 12c R3 是第一个通过实体框架 (EF) 6 和 EF Code First 认证的 ODP.NET 版本。 http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html

回答by bricelam

Devart recently announced Oracle 12c support. You may want to consider using their provider instead.

Devart 最近宣布了对Oracle 12c 的支持。您可能需要考虑改用他们的提供商。

回答by kin gold

In additional to add Oracle.ManagedDataAccess.Client provider to configuation/entityframework/providers tag.

此外将 Oracle.ManagedDataAccess.Client 提供程序添加到 configuation/entityframework/providers 标签。

<entityFramework>
<providers>
  <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /></providers></entityFramework>

You may need to add the following DbProviderFactories tag to configuration/ because Oracle installer forgets to add it to the machine.config

您可能需要将以下 DbProviderFactories 标记添加到 configuration/ 因为 Oracle 安装程序忘记将其添加到 machine.config

  <system.data>
<DbProviderFactories>
  <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.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>

回答by Paul

The error you're receiving states that you didn't add a Oracle.ManagedDataAccess.Client to the providers tag.

您收到的错误表明您没有将 Oracle.ManagedDataAccess.Client 添加到 providers 标记。

Adding this will solve your problem:

添加这将解决您的问题:

<provider invariantName="Oracle.ManagedDataAccessClient"
                type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

but unfortunately will not work in the end due to lack of support for EF6 in ODAC 12c R2, as mentioned in the comments.

但不幸的是,如评论中所述,由于 ODAC 12c R2 中缺乏对 EF6 的支持,最终将无法使用。