18

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?

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
whoadityanawandar
  • 1,014
  • 8
  • 27
  • 60

9 Answers9

10

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

Mehmet Kurt
  • 161
  • 2
  • 3
6

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

Hieu Le
  • 935
  • 7
  • 16
2

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

ssanga
  • 166
  • 3
  • 10
  • I don't know.. Now I am stuck at a different error, "The listener does not currenlty know...........". I can't remember what changes I made. All I am trying to do is get an MVC app running with an Oracle db with DB first approach. I am using VS 2015 which also has official support from Oracle. Yet can't get this thing running. Its so stupid. I think I should move to sql server. Oracle is really frustrating with so much mess. – whoadityanawandar Nov 23 '16 at 07:10
  • It´s a little bit tricky at first, but once you have configured it property, it works ok. Related with the listener, you should check your tnsnames.ora file – ssanga Nov 23 '16 at 09:22
1

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

toha
  • 4,097
  • 3
  • 31
  • 49
0

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

Sundus
  • 1
  • 1
0

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

Jack Lee
  • 11
  • 5
0

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.

NgoniDee
  • 1
  • 2
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Anton Menshov Aug 18 '19 at 03:55
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

NickCoder
  • 1,232
  • 1
  • 15
  • 29
-2

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">
Zeni
  • 677
  • 1
  • 7
  • 20
  • Did you read the question? It's about Oracle, not MySQL, so this is not an answer. Also, if you answer old questions already having multiple answers it's always appreciated if you explain what your answer adds to the existing content. – Gert Arnold Apr 16 '18 at 12:48
  • Did you read the error message at top of question? This message can appear in number of scenarios. In fact I reached this page only because I was getting this error message while working with MySQL in VS 2017 (an oracle product) and is an issue of connector. In an answer bellow mention of Configuration gave me hint. Just tried to help others as I was helped by others' answers many many many times. Some times just a hint is enough. Don't rush to down vote others, try to see intent behind it. – Zeni Apr 17 '18 at 03:53