I can not get a provider for Oracle with Code First

6

I'm doing the following:

Model dou Add folder > New Item follows images

ThenIselectADO.NetEntity,giveitaname,andADD

SelectCodeFirstandgiveNext

Wellatthisstep,Iselect,andseefromtheimagethatIdonothavetheOracleClientoptionandIalreadyaddeditintheprojectreference.HowdoIgofromheretoworkwithOracle?

Therewasadetailmissing:IalreadycreatedtheconnectionwithOracleinServersExplorerandtesteditanditisok.

IfollowedinthefootstepsofcolleagueMorrison,andwhenIgettoconnect,he'smakingthatmistake.WhatelsedoIhavetodo,tosolvethis?

Here'showI'mdoing:

Isolvedtheissueoftheerrorposted,itwasthetnsnamesthatwaswrong,andnowitisgivingthisothererror:

    
asked by anonymous 05.11.2015 / 13:14

1 answer

2

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

The easy way is to install the official Oracle NuGet package . There are two ways to do it:

  • In Visual Studio, go to Tools > Extensions and Updates > Look for the package there. I do not recommend this because sometimes the package does not appear;
  • In Visual Studio, go to View > Other Windows > Package Manager Console and type in it:

    PM> Install-Package Oracle.ManagedDataAccess.EntityFramework
    
  • Once this is done, open your Web.config and locate the <entityFramework> tag. If any, replace the entire 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 it does not, put the above content before </configuration> .

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

    EDIT

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

    You can download it here .

        
    05.11.2015 / 14:46