jack3694078
jack3694078

Reputation: 1033

How to add Oracle provider in VS2017 for Entity Framework?

I want to connect to a database(Oracle 12c) for generating ADO.NET model, Code First From Database. I have installed ODAC for VS but there is still no option for connecting Oracle DB at the Entity Data Model Wizard: enter image description here

At Server Explorer there is a Oracle provider but it is stated as deprecated: enter image description here

I've also tried to install the following 4 Nuget packages but still no Oracle provider at Entity Data Model Wizard: enter image description here

I'm suspecting VS2017(Community) is not looking at where I installed ODAC for the list of providers it use but I can't figure where it store this configuration.

Is there anything I'm missing? Or is there other ways to use EF for Oracle? E.g. Fallback to VS2015, create entity models manually (how do I do that?), etc.

Please help me I don't want to write plain SQL in code ever again! Thanks.

Upvotes: 6

Views: 17009

Answers (5)

kmxr
kmxr

Reputation: 479

I solved this by installing Oracle Developer Tools for Visual Studio 2017

Upvotes: 2

monir hossain
monir hossain

Reputation: 1

I was facing same problem. first ensure that you installed odac for visual studio 2017 just go this link and follow: https://www.oracle.com/technetwork/topics/dotnet/downloads/odacmsidownloadvs2017-3806459.html uninstall previous odac version. Hopefully, if you install from the link, you will get all things.

Upvotes: 0

Joaquim Raurell.Xerox
Joaquim Raurell.Xerox

Reputation: 31

There is something extra:

  • Nuget package manager suggests Oracle.ManagedDataAccess.EntityFramework 18.3.0

This won't work with the latest ODP. Nuget Package versions should match ODP versions:

  • ODP 12.2.0.1.1
  • Nuget Oracle.ManagedDataAccess.EntityFramework 12.2.1100

If not the Entity Data Model Wizard will crash without leaving any trace in the

C:\Users\YOURUSER\AppData\Roaming\Microsoft\VisualStudio

Upvotes: 3

Par Douhan
Par Douhan

Reputation: 1

I hade the sam problem, but found the solution here:

Do not use the .NET driver. Use the ODP.NET driver (managed or unmanaged).

http://www.oracle.com/technetwork/topics/dotnet/whatsnew/vs2012welcome-1835382.html

Create a new connection from Server Explorer in Visual Studio and use these images as guides: change the datasource, making sure to choose the flavor of ODP.NET that your .NET application will use (Managed or Unmanaged) - and then connect to oracle. In the Oracle connection dialog, if you have a connection alias choose a "Connection Type" of "TNS" and then choose the alias from the "Data Source Name" drop down list. If you do not have a connection alias, you can choose a Connection Type of "EZ Connect" and then provide the host, port, and service name for the database you wish to connect to.

Best Regards, Par

Upvotes: 0

Hong Van Vit
Hong Van Vit

Reputation: 2986

I have the same error. I solve this problem by add Oracle database from Visual 2015. And then Open project by Visual 2017. It done. I has been read a lot of topic about this. They say now, Oracle not yet Support for connecting Oracle DB at the Entity Data Model Wizard you can see at here: https://community.oracle.com/thread/4024914

Upvotes: 4

Related Questions