Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 658
jack3694078 Avatar asked Aug 30 '17 00:08

jack3694078


People also ask

Can we use Oracle in Entity Framework?

Yes. See this step by step tutorial of Entity Framework, LINQ, and Model-First for the Oracle database (11G), and using Visual Studio 2010 with .

How do I add a Model to EDMX?

In the Model Browser, right-click the . edmx file and select Update Model from Database. Expand the Tables, Views, and Stored Procedures nodes, and check the objects you want to add to the . edmx file.

How do you add a Model entity?

Now, add Entity Data Model by right clicking on the project in the solution explorer -> Add -> New Item. This will open the Add New Item popup. In the popup, select ADO.NET Entity Data Model and provide an appropriate name to the EDM ('School' in this case) and click the Add button.


3 Answers

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

like image 196
Hong Van Vit Avatar answered Oct 17 '22 17:10

Hong Van Vit


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

like image 42
Joaquim Raurell.Xerox Avatar answered Oct 17 '22 17:10

Joaquim Raurell.Xerox


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

like image 2
kmxr Avatar answered Oct 17 '22 17:10

kmxr