oracle 您的项目引用了最新版本的实体框架... - 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40745182/
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 03:20:06  来源:igfitidea点击:

Your project references the latest version of Entity Framework... - Error

oracleentity-frameworkvisual-studioado.net-entity-data-model

提问by whoadityanawandar

I trying to create an entity data model with Oracle. I am getting this error.

我试图用 Oracle 创建一个实体数据模型。我收到此错误。

enter image description here

在此处输入图片说明

I have these installed for my solution.

我为我的解决方案安装了这些。

enter image description here

在此处输入图片说明

I have also installed ODT for VS 2015.

我还为 VS 2015 安装了 ODT。

These are my references showing.

这些是我的参考资料。

enter image description here

在此处输入图片说明

Web.config

网页配置

<configSections>
    <section name="entityFramework"     
             type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,     EntityFramework, Version=6.0.0.0, Culture=neutral,     PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<connectionStrings>
    <add name="OracleDbContext" 
         providerName="Oracle.ManagedDataAccess.Client" 
         connectionString="User Id=system;Password=myPassword;Data Source=ABC_DB" />
</connectionStrings>
<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
</system.web>
<system.webServer>
   <modules>
       <remove name="FormsAuthentication" />
   </modules>
</system.webServer>
<runtime>
 ........
</runtime>
<entityFramework>
    <defaultConnectionFactory  
         type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework">
    </defaultConnectionFactory>
    <providers>
        <!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        <provider invariantName="Oracle.ManagedDataAccess.Client" 
                  type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />-->
        <provider invariantName="Oracle.ManagedDataAccess.Client" 
                  type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
</entityFramework>
<system.codedom>
    <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
</system.codedom>
<system.data>
   <DbProviderFactories>
       <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.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
  <version number="*">
  <dataSources>
    <dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
  </dataSources>
 </version>
</oracle.manageddataaccess.client>

What am I missing?

我错过了什么?

回答by Mehmet Kurt

"Your project references the latest version of Entity Framework" Problem with VS 2017 and Oracle 12c When we add item ADO.NET Entity Data Model with Oracle connection then error message displaying "Your project references the latest version of Entity Framework..."

“您的项目引用了最新版本的实体框架”VS 2017 和 Oracle 12c 问题

Resolution steps are here ;

解决步骤在这里;

  1. Install Oracle ODTwithODAC122010 as a 32Bit

  2. Create Your Project in VS2017

  3. Change Active Solution Platform to 32 Bit from AnyCPU

  4. Open Tools->Nuget PackageManager-> Manage Nuget Packages for Solution

  1. 将 Oracle ODTwithODAC122010 安装为 32 位

  2. 在 VS2017 中创建你的项目

  3. 将 Active Solution Platform 从 AnyCPU 更改为 32 位

  4. 打开工具->Nuget PackageManager-> 管理解决方案的 Nuget 包

5-Write Browse Area "ODP" and Install Following Program

5-写入浏览区“ODP”并安装以下程序

  • Oracle. ManagedDataAccess

  • Oracle.ManagedDataAccess.EntityFramework

  • 甲骨文。托管数据访问

  • Oracle.ManagedDataAccess.EntityFramework

6- Open Tools->Nuget PackageManager-> Package Manager Console

6- 打开工具-> Nuget PackageManager-> 包管理器控制台

7- Write this

7-写这个

- Install-Package EntityFramework -Version 6.1.1  

and Enter

8-Re-Start Visual Studio to finish the process

8-重新启动Visual Studio以完成该过程

8-Re-Build your application

8-重新构建您的应用程序

8- Add new item ADO.NET Entity Data Model

8- 添加新项目 ADO.NET 实体数据模型

9-If required Add New Connection to Oracle (Data Source = Oracle Database(ODP.NET, Managed Driver))

9-如果需要,将新连接添加到 Oracle(数据源 = Oracle 数据库(ODP.NET,托管驱动程序))

10 - Everything is OK.

10 - 一切正常。

Note : I quess EF6.1.3 is not working with VS2017 and Oracle ODTwithODAC122010. But after all of these process I have changed EF as a EF6.1.3 it is working But I do not advice you.

注意:我问 EF6.1.3 不适用于 VS2017 和 Oracle ODTwithODAC122010。但是在所有这些过程之后,我已将 EF 更改为 EF6.1.3,它正在运行但我不建议您。

回答by Hieu Le

I met this problem today. Then I resolved by following steps:

我今天遇到了这个问题。然后我通过以下步骤解决:

Normally, in case we wanna use MySQL with Entity Framework, we will add some DLLs such as MySql.Data, MySql.Data.Entity.EF6.

通常,如果我们想在实体框架中使用 MySQL,我们会添加一些 DLL,例如 MySql.Data、MySql.Data.Entity.EF6。

But we forgot one thing that Visual Studio need to work with MySQL.

但是我们忘记了 Visual Studio 需要与 MySQL 一起工作的一件事。

That's adding configurations on App.config/Web.config:

那就是在 App.config/Web.config 上添加配置:

<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers>
  </entityFramework>
<system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

Then, Build your whole projects and try again.

然后,构建您的整个项目并重试。

Another solution is:using Nuget to add MySQL dlls. It will be added configurations into App.config/Web.config file

另一种解决方案是:使用 Nuget 添加 MySQL dll。它将添加配置到 App.config/Web.config 文件中

回答by ssanga

you have to go to your proyect-->properties-->Compile-->And set platform to x86

你必须去你的项目-->属性-->编译-->并将平台设置为x86

Save all changes, rebuild, add the Entity Data Model and now it will work.

保存所有更改,重建,添加实体数据模型,现在它可以工作了。

It happened to us at our job a lot of times!

在我们的工作中它发生了很多次!

This is because the ODT is for 32 bit, and probably you have your project in AnyCpu or x64 and your Operating System is x64.

这是因为 ODT 适用于 32 位,并且您的项目可能是 AnyCpu 或 x64,而您的操作系统是 x64。

Hope it helps

希望能帮助到你

回答by toha

My Computer :Win 7 64 bit

我的电脑:Win 7 64 位

VS 2015

VS 2015

Oracle Server :

甲骨文服务器:

version 12G - 32 bit

版本 12G - 32 位

What I have tried until success :

我尝试过的直到成功:

-downgrade Oracle.ManagedDataAccess.EntityFramework and Oracle.ManagedDataAccess from 18.3.0 to 12.2.20190115

-将 Oracle.ManagedDataAccess.EntityFramework 和 Oracle.ManagedDataAccess 从 18.3.0 降级到 12.2.20190115

-Change Build mode from Any CPU to x86

- 将构建模式从任何 CPU 更改为 x86

-Configuration app.config:

-配置app.config:

  <configSections>
    <section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
  </configSections>

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

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

-Nuget installed: Oracle.DataAccess.x86 - v.2.112.1

-Nuget 安装:Oracle.DataAccess.x86 - v.2.112.1

Oracle.ManagedDataAccess.EntityFramework - v.12.2.20190115

Oracle.ManagedDataAccess.EntityFramework - v.12.2.20190115

Oracle.ManagedDataAccess - v.12.2.1100

Oracle.ManagedDataAccess - v.12.2.1100

EntityFramework - v.6.2.0

实体框架 - v.6.2.0

installed ODAC : ODTwithODAC122011.zip

已安装 ODAC:ODTwithODAC122011.zip

回答by NgoniDee

The following link helped me... Solve Project References

以下链接帮助了我... 解决项目参考

In my case the point was to adding the references carefully keeping the version consistent and updating the the config file correspondingly.

就我而言,重点是添加引用以保持版本一致并相应地更新配置文件。

回答by Muhammad Shees Aslam

firstly Go and Delete Model delete both entity framework references.
After that add your model and write this in the package manager console :

首先 Go 和 Delete Model 删除两个实体框架引用。
之后添加您的模型并将其写入包管理器控制台:

install-package EntityFramework

install-package EntityFramework

回答by Sundus

Install Entity Framework if it's not installed, Rebuild your project and add a new connection. It resolves the issue for me.

如果未安装,请安装实体框架,重建项目并添加新连接。它为我解决了这个问题。

回答by Hyman Lee

I managed to resolve this issue by updating the Entity Framework to 6.1.3, Oracle Managed Data Access to 12.1.24160719 and Oracle Managed Data Access Entity Framework to 12.1.2400. Please use the nuget manager to update. After this, It WORKS!!!

我通过将实体框架更新到 6.1.3、将 Oracle Managed Data Access 更新到 12.1.24160719 并将 Oracle Managed Data Access Entity Framework 更新到 12.1.2400 设法解决了这个问题。请使用 nuget 管理器进行更新。在此之后,它起作用了!!!

回答by Zeni

As given here enter link description hereadding below in web.config solved this problem for me.

正如此处给出的,在此处 输入链接描述在 web.config 中添加以下内容为我解决了这个问题。

Set the DbConfiguration type in the configuration file:

在配置文件中设置 DbConfiguration 类型:

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">