who-aditya-nawandar
who-aditya-nawandar

Reputation: 1342

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

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

enter image description here

I have these installed for my solution.

enter image description here

I have also installed ODT for VS 2015.

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?

Upvotes: 20

Views: 23201

Answers (10)

zakk616
zakk616

Reputation: 1552

These settings worked for me.

Environment:

Visual Studio 2019

.Net Framework 4.6.2

Packages:

EntityFramework 6.1.3

Oracle.ManagedDataAccess 19.3.1

Oracle.ManagedDataAccess.EntityFramework 19.3.0

Upvotes: 0

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

install-package EntityFramework

Upvotes: 0

NgoniDee
NgoniDee

Reputation: 1

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.

Upvotes: 0

toha
toha

Reputation: 5510

My Computer : Win 7 64 bit

VS 2015

Oracle Server :

version 12G - 32 bit

What I have tried until success :

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

-Change Build mode from Any CPU to x86

-Configuration 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

Oracle.ManagedDataAccess.EntityFramework - v.12.2.20190115

Oracle.ManagedDataAccess - v.12.2.1100

EntityFramework - v.6.2.0

installed ODAC : ODTwithODAC122011.zip

Upvotes: 1

Zeni
Zeni

Reputation: 1005

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

Set the DbConfiguration type in the configuration file:

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

Upvotes: -2

Hieu Le
Hieu Le

Reputation: 1132

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.

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

That's adding configurations on 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

Upvotes: 6

Mehmet Kurt
Mehmet Kurt

Reputation: 161

"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..."

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

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

  • Oracle. ManagedDataAccess

  • Oracle.ManagedDataAccess.EntityFramework

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

7- Write this

- Install-Package EntityFramework -Version 6.1.1  

and Enter

8-Re-Start Visual Studio to finish the process

8-Re-Build your application

8- Add new item ADO.NET Entity Data Model

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

10 - Everything is OK.

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.

Upvotes: 10

Jack Lee
Jack Lee

Reputation: 11

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!!!

Upvotes: 0

Sundus
Sundus

Reputation: 1

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

Upvotes: 0

ssanga
ssanga

Reputation: 355

you have to go to your proyect-->properties-->Compile-->And set platform to 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.

Hope it helps

Upvotes: 2

Related Questions