您的项目引用了最新版本的Entity Framework ... - 错误

who*_*dar 15 oracle entity-framework ado.net-entity-data-model visual-studio

我试图用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>
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

小智 10

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

解决步骤在这里;

  1. 将Oracle ODTwithODAC122010安装为32位

  2. 在VS2017中创建项目

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

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

5写入浏览区"ODP"并安装以下程序

  • 甲骨文.ManagedDataAccess

  • Oracle.ManagedDataAccess.EntityFramework

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

7-写下这个

- Install-Package EntityFramework -Version 6.1.1  

and Enter
Run Code Online (Sandbox Code Playgroud)

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

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

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

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

10 - 一切都好.

注意:我认为EF6.1.3不能与VS2017和Oracle ODTwithODAC122010一起使用.但是在完成所有这些过程之后我将EF更改为EF6.1.3它正在工作但是我不建议你.


Hie*_* Le 6

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

通常,如果我们想在实体框架中使用 MySQL,我们会添加一些 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>
Run Code Online (Sandbox Code Playgroud)

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

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


ssa*_*nga 2

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

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

这种事在我们工作中发生过很多次!

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

希望能帮助到你