I’m not getting a Oracle file with Code First

Asked

Viewed 523 times

6

Here’s what I’m doing:

Folder Model dou Add > New Item follows pictures inserir a descrição da imagem aqui

Then select ADO.Net Entity, give a name and ADD inserir a descrição da imagem aqui

I select Code First and give Next inserir a descrição da imagem aqui

Well in this step, I select , and look at the image that I don’t have the Oracle Client option and I’ve already added it in the project reference. How I do from there to work with Oracle?

One detail was missing: I already created the connection to Oracle in Servers Explorer and tested and is ok.

I followed the steps of colleague Morrison and when I set my connection, now gives this error. What else do I have to do, to solve this?

inserir a descrição da imagem aqui

See here how I’m doing: inserir a descrição da imagem aqui

I solved the issue of posted error, it was the tnsnames that was wrong, and now is giving this other error: inserir a descrição da imagem aqui

  • Take a look here, http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm. versions are different, see if you have done the steps correctly.

1 answer

2


This is the terribly difficult way to work with the Oracle driver within ASP.NET MVC.

The easy way is installing the official Nuget package from Oracle. There are two ways to do:

  1. In Visual Studio, go to Tools > Extensions and Updates > Look for the package there. I don’t recommend this because sometimes the package doesn’t appear;
  2. In Visual Studio, go to View > Other Windows > Package Manager Console and type in it:

    PM> Install-Package Oracle.ManagedDataAccess.EntityFramework
    

Once done, open your Web.config and locate the tag <entityFramework>. If there is, replace the whole tag with the following:

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework" />
    </providers>
  </entityFramework>

If not, put the above content before </configuration>.

Done this, your project is ready to work with Entity Framework and Oracle.


EDIT

Since you want ADO.NET Entity Data Model Wizard, you will need to install the adapter for the IDE that allows you to use Oracle in Wizard: Oracle Developer Tools for Visual Studio.

You can download it here.

  • I did all these steps that you mentioned in your post, but even so I can’t get a preview for oracle using EF Code First, ie in the steps I put in the post. Still nothing coming up.

  • Do you really want to use the ADO.NET Entity Data Model? Okay, I expand the answer.

  • So that’s what I got for an Internet consultation I did, but I’m open to suggestions for the better. What I’m doing is just a POC to demonstrate to the superiors the use of Reportviewer, instead of the Jasper report, given the problems presented by it(Tomcat).

  • So, but this way of setting up a base by Code First is no longer being used, but ok, I put a link for you in the answer. See now.

  • I think I need to change my approach. It didn’t work out, I installed this patch that you referred me and still don’t have Previder. I will search for another way to work with Oracle in Entity, anyway, thank you.

  • 1

    I think ODAC is missing. I’m going to install it and see what happens. Anyway, I’m open to ideas. I will open another post on the subject, of which best way to work with Entity and Oracle.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.