Entity Framework with Oracle Banks

Asked

Viewed 4,809 times

9

I am creating an application in which will use an Oracle database, but when inserting the .edmx (Entity Data Model) I came across the following situation!

inserir a descrição da imagem aqui

I can’t create a connection with Oracle Bank. What do I need to do to get this done? Do I have to install a driver? Or it is not possible to work with Entity framework and Oracle databases?

  • 1

    It is necessary to install a driver to the Oracle database, so Visual Studio recognizes the driver and shows the option in this Wizard. I’ve been through this problem using Postgresql

2 answers

8


Yes, the ODP.NET:

http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html

Here is some more information:

http://www.oracle.com/technetwork/pt/topics/dotnet/index-085163.html

By the time of this response, the Entity Framework does not work well with Oracle, but you can write your own Repository with bank operations and make a override from your context to behave like a native Entity Framework.

I have a project that works like this. If you want to go this way, please ask more questions that I will post code examples that you can work with.


EDIT

I had said that Oracle does not work with Entity Framework, but this response has become outdated, so I’m updating.

First you need to install the Nuget package Oracle.ManagedDataAccess.Entityframework. The configuration of Web.config should look like this:

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
  </entityFramework>

It is also necessary to define a Connection string for Oracle to work properly.

Once done, just work normally with the Entity Framework that should work.

  • Gypsy, I know the topic is kind of old but I’m interested in knowing how you did this Pository, can you send me something to take a look? Or does Entity already support Oracle well? Thank you.

  • @Alanalmeida EF already supports Oracle well, but at the time I did something like this. This is valid if you use ADO.NET or Dapper, not EF.

  • Wonderful, thank you.

1

Here are all Ado . Net Data providers for the various databases. Some of these drivers do not work properly, but the paid ones do. So only to ratify that depending on the bank and depending on the version of the bank do not accompany the development and improvement of the ORM Entity Framework.

Browser other questions tagged

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