Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 730
who-aditya-nawandar Avatar asked Nov 22 '16 15:11

who-aditya-nawandar


2 Answers

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

like image 71
Mehmet Kurt Avatar answered Nov 15 '22 18:11

Mehmet Kurt


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

like image 6
Hieu Le Avatar answered Nov 15 '22 17:11

Hieu Le