Cannot connect to Oracle Database with Entity Framework in ASP.NET MVC project

3k Views Asked by At

Context : I'm creating a web app (in ASP.NET MVC 4) that will offer access to an already existing Oracle database. I'll only need to be able to read data from that DB, no insert, or update, etc. I'm working in Visual Studio Express 2015 for Web.

I've searched a lot for answers to my problems, but to no avail.

My goal is to create models with Entity Framework Database first. I have added Entity Framework, Oracle.ManagedDataAccess, and Oracle.ManagedDataAccess.EntityFramework to my project with NuGet.
However, when I try to add an "ADO.NET Entity Data Model" to my Models, whether I select "EF Designer from database" or "Code First from database", I get the following:

As you can see, there is no "Oracle Database" option.

What am I missing ?

I've found resources saying I need to install Oracle Developer Tools for Visual Studio. However, it is not supported in Visual Studio Express, and I cannot change my IDE.

I don't have Oracle client installed on this dev computer, but I sqldeveloper, and have no issue accessing the database with it. Do I NEED to install the Oracle client ? Aren't the dll installed throught NuGet enough ? I'm asking because I'm an intern, and installing any new piece of software requires validation, that takes quite a long time.

2

There are 2 best solutions below

0
someplaces On
  1. add connection your database to your project
  2. Insert New Item an Empty Dataset
  3. In that dataset insert TableAdapter from toolbox into your dataset.
  4. window pops up for selecting tables (you can write sql for select a desired table)
  5. after step 4. you have your entity.
0
Hong Van Vit On

I have the same bug and I fix like this:

You need instal:

  • Microsoft Visual Studio 2015 or later with .NET Framework 4.5 or later.

  • Oracle Database 12c or later.

  • Oracle Data Access Components (ODAC) 12c Release 3 (12.1.0.2.1) or later from OTN. The ODAC download includes Oracle Developer Tools for Visual Studio and ODP.NET

  • Files required for this tutorial.
  • Using NuGet to Install and Configure Oracle Data Provider for .NET tutorial.(install: Oracle.ManagedDataAccess.EntityFramework from Nuget).

refer: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/2015/entityframework_linq_modelfirst/Entity%20Framework%20LINQ%20and%20Model%20First.html#overview