【问题标题】:Your project references the latest version of Entity Framework... - Error您的项目引用了最新版本的实体框架... - 错误
【发布时间】:2016-11-22 15:01:31
【问题描述】:

我尝试使用 Oracle 创建实体数据模型。我收到此错误。

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

我还为 VS 2015 安装了 ODT。

这些是我的参考资料。

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>

我错过了什么?

【问题讨论】:

    标签: oracle entity-framework visual-studio ado.net-entity-data-model


    【解决方案1】:

    “您的项目引用了最新版本的实体框架”VS 2017 和 Oracle 12c 的问题 当我们使用 Oracle 连接添加项 ADO.NET 实体数据模型时,错误消息显示“您的项目引用了最新版本的实体框架...”

    解决步骤在这里;

    1. 将 Oracle ODTwithODAC122010 安装为 32 位

    2. 在 VS2017 中创建您的项目

    3. 将主动解决方案平台从 AnyCPU 更改为 32 位

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

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

    • 甲骨文。托管数据访问

    • Oracle.ManagedDataAccess.EntityFramework

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

    7- 写这个

    - Install-Package EntityFramework -Version 6.1.1  
    
    and Enter
    

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

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

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

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

    10 - 一切正常。

    注意:我怀疑 EF6.1.3 不适用于 VS2017 和 Oracle ODTwithODAC122010。但是在所有这些过程之后,我已经将 EF 更改为 EF6.1.3 它正在工作 但我不建议你。

    【讨论】:

    • 将 Active Solution Platform 从 AnyCPU 更改为 32 位 原因就在于此。
    • 将构建从 AnyCPU 更改为 32 位 (x86) 对我有用。
    【解决方案2】:

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

    通常情况下,如果我们想将 MySQL 与 Entity Framework 一起使用,我们会添加一些 DLL,例如 MySql.Data、MySql.Data.Entity.EF6。

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

    这是在 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>
    

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

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

    【讨论】:

      【解决方案3】:

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

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

      我们在工作中经常遇到这种情况!

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

      希望对你有帮助

      【讨论】:

      • 我不知道.. 现在我遇到了另一个错误,“听众不知道当前......”。我不记得我做了什么改变。我要做的就是让一个 MVC 应用程序与 Oracle db 一起运行,并采用 DB first 方法。我正在使用 VS 2015,它也得到了 Oracle 的官方支持。然而无法让这东西运行。它是如此愚蠢。我想我应该转移到 sql server。甲骨文对这么多混乱感到非常沮丧。
      • 一开始有点棘手,但是一旦你配置了它的属性,它就可以正常工作了。与监听器相关的,你应该检查你的 tnsnames.ora 文件
      【解决方案4】:

      我的电脑: 赢7 64位

      VS 2015

      甲骨文服务器:

      版本 12G - 32 位

      我所尝试的直到成功:

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

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

      -配置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 已安装: Oracle.DataAccess.x86 - v.2.112.1

      Oracle.ManagedDataAccess.EntityFramework - v.12.2.20190115

      Oracle.ManagedDataAccess - v.12.2.1100

      EntityFramework - v.6.2.0

      已安装 ODAC:ODTwithODAC122011.zip

      【讨论】:

      • 我正在使用 VS2017 我使用了设置,最后它的工作:)
      【解决方案5】:

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

      【讨论】:

        【解决方案6】:

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

        【讨论】:

          【解决方案7】:

          以下链接帮助了我... Solve Project References

          在我的例子中,重点是仔细添加引用以保持版本一致并相应地更新配置文件。

          【讨论】:

          • 虽然理论上这可以回答这个问题,it would be preferable 在这里包含答案的基本部分,并提供链接以供参考。
          【解决方案8】:

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

          install-package EntityFramework

          【讨论】:

            【解决方案9】:

            这里给出 enter link description here 在 web.config 中添加以下内容为我解决了这个问题。

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

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

            【讨论】:

            • 你读过这个问题吗?这是关于 Oracle,而不是 MySQL,所以这不是一个答案。此外,如果您回答已经有多个答案的旧问题,如果您解释您的答案添加到现有内容中的内容,我们将不胜感激。
            • 您是否阅读了问题顶部的错误消息?此消息可能会出现在多个场景中。事实上,我到达这个页面只是因为我在 VS 2017(一个 oracle 产品)中使用 MySQL 时收到了这个错误消息,并且是连接器的问题。在下面的回答中提到配置给了我提示。只是试图帮助别人,因为我被别人的答案帮助了很多很多次。有时只是一个提示就足够了。不要急于给别人投反对票,试着看看背后的意图。
            猜你喜欢
            • 2019-02-13
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2014-10-27
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多