6692

Entity Framework Code First and Oracle ODAC 12c Release 3 Error

Question:

A bit stumped with this one...

I'm receiving the following error when setting up Code First on Entity Framework and Oracle...

<blockquote>

No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client'. Make sure the provider is registered in the 'entityFramework' section of the application config file.

</blockquote>

With the following setup...

Entity Framework 6.1.1

ODAC 12c Release 3

Any ideas on how to fix this problem?

I've included the app.config file below...

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <connectionStrings> <add name="Context" connectionString="DATA SOURCE=****;PASSWORD=****;PERSIST SECURITY INFO=True;POOLING=False;USER ID=SYSTEM" providerName="Oracle.ManagedDataAccess.Client" /> </connectionStrings> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework> </configuration>

Answer1:

since you have used a providerName <strong>Oracle.ManagedDataAccess.Client</strong> in connectionString. you need to add a line in following section to define it:

<providers> <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices,OracleManagedDataAccess.EntityFramework" /> </providers>

Answer2:

Am trying to do the same . but not working with me either , Did you managed to make it work ?

Try to add the provider to your config file :

<providers> <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </providers>

Also check this link <a href="https://community.oracle.com/message/12679686" rel="nofollow">https://community.oracle.com/message/12679686</a>

Answer3:

After messing today for a few hours with the same error I found that I missed to select the correct T4 templates (see step #3)

<ol><li>

Install "ODAC 12c Release 3 and Oracle Developer Tools for Visual Studio"

Btw. I found this note on a <a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE_2/EntityFrameworkOBE.html#overview" rel="nofollow">Oracle website</a>:

<blockquote>

Note: If you have installed ODAC 12c Release 3 configured on a machine-wide level, you will see an error when trying to generate database scripts using Entity Framework Model-First. To resolve this issue, use an ODAC version later than this release or reinstall ODAC 12c Release 3 with the "Configure ODP.NET at a machine-wide level" box UNchecked.

</blockquote></li> <li>

Add those nuget packages to you project:

<ul><li>EntityFramework (6.1.3 here)</li> <li>Offical Oracle ODP.NET, Managed Entity Framework Driver (12.1.022 here)</li> </ul>

Those will also add some dependent packages and insert the necessary configuration into the App.config.

</li> <li>

Before generating the database, choose the correct T4 templates in the properties of the EDMX model before generating the database.

</li> </ol>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/6pQpJ.png" data-original="https://i.stack.imgur.com/6pQpJ.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

The pre-selected templates are designed for MS SQL Server (I guess).

Recommend

  • One-to-one relationship with EFCore 2.1
  • How can resolve Untrusted certificates Error ?( TFS2013 Build and deploy to IIS )
  • Why is a variable defined locally successfully accessible from within another function?
  • Configure Vs code version 2.0.0 Build Task for python
  • Why cant a web service return a dictionary?
  • EntityFramework ignore login name in connectionString
  • Using Roslyn scripting in UWP
  • Could not load file or assembly 'System.ServiceModel.Web, Version=4.0.0.0'
  • TypeScript error TS5014: Unexpected token u in JSON at position 0
  • How can I use the system.net section of my app.config in a partial trust environment?
  • Deploy Failed : CLR Trigger
  • Can't build solution because of missing NuGet references
  • Log4net buffer size not working
  • reading content of an config file into the dll associated with it
  • Azure Bot Framework Emulator Error - System.ArgumentNullException: Value cannot be null
  • ModelState.isValid - false
  • Where can I download the Windows Phone Developer tools?
  • Does Windows Phone 7 have a standard Edit/Add/Delete convention?
  • yii2 create translated URLs
  • Why isn't RAD (Eclipse) able to properly detect WAS server startup?
  • Sharing Redis settings across routes
  • Laravel phpunit always 404
  • An unexpected error has been detected by HotSpot Virtual Machine
  • php show all images in directory and sort by last modified
  • SQL getting multiple columns into one column
  • MeeGo Handset Emulator not starting on Windows 7
  • How Get arguments value using inline assembly in C without Glibc?
  • How to get Eclipse Oxygen to run on Java 9
  • How would I use PHP exceptions to define a redirect?
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Web-crawler for facebook in python
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • How to stop GridView from loading again when I press back button?
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs