Josh Ferrell
Josh Ferrell

Reputation: 99

No Entity Framework Provider for ADO.NET Oracle.ManagedDataAccess.Client Without Config

I'm getting the following error whenever I try to run this query:

var query = from u in StageEntity.STAGINGINTERACTIONPOINTS
  where u.OBJECTID == OBJECT_ID
  select u;

"Schema specified is not valid. Errors: \r\nStagingDB.ssdl(2,2) : error 0152: 
No Entity Framework provider found for the ADO.NET provider
with invariant name 'Oracle.ManagedDataAccess.Client'. 
Make sure the provider is registered in the 'entityFramework' 
section of the application config file. 
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."

However, the issue I believe is that I'm unable to access a config file in runtime. This is because my application is an ArcObjects Extension and for some reason ignores all Config files that are not Config.esriaddinx. Therefore at run time, I get the connection string from the config file.

This works fine for SQL servers, but I have not tried this in Oracle before. I was wondering if there is something I need to include and declare at runtime for Oracle ODP to work.

Here's the connection string that I pull and call:

connection string="DATA SOURCE=(DESCRIPTION=(ADDRESS= (PROTOCOL=TCP) (HOST=examplehost.com)(PORT=1234))(CONNECT_DATA=(SID = sid)));PASSWORD=hunter2;PERSIST SECURITY INFO=True;USER ID=poor_username""

I then call this connection string whenever I declare an entity which I did making a partial class

I have also looked at another stack question that had a similar issue, but I'm running the latest ODP.net (v 6.121) with Entity 6 which should be compatible.

Also, the following fix:

public partial class StagingEntities : DbContext
{
    private volatile Type _dependency;

    public StagingEntities(string connectionString)
        : base(connectionString)
    {
        _dependency = typeof(System.Data.Entity.SqlServer.SqlProviderServices);

    }
}

does not work.

Upvotes: 3

Views: 11183

Answers (3)

neilsimp1
neilsimp1

Reputation: 1259

What worked for me was copying the App.config from my .NET Framework EF project into my .NET Core MVC project.

Upvotes: 0

Ratna Aloorkar
Ratna Aloorkar

Reputation: 61

Your solution: Please reinstall NuGet package for Oracle.ManagedDataAccess.Client-https://www.nuget.org/packages/Oracle.ManagedDataAccess.EntityFramework/

Extra information: I had the exact same issue, but for Oracle.DataAccess.Client. My issue said: "No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.DataAccess.Client'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.".

I had recently migrated from EF5 to EF6. The old version of Oracle Managed ODP is not compatible with EF6. After installing Oracle.ManagedDataAccess.EntityFramework, I had to replace all occurrences of Oracle.DataAccess.Client in my project to Oracle.ManagedDataAccess.Client. It worked fine.

Upvotes: 6

AarKay
AarKay

Reputation: 1

I had this same problem couple of weeks back. I am using Entity Framework 6.1.3 and ODP latest. I am using the entity framework in console library(.dll) and calling it from a WCF Service.

The solution that worked for me was I have to install the nuget package for the entity framework and ODP provider in the WCF service too, as it refers for the ODP configuration only from the WCF web config. (Weird, but I have to do that).

Also read somewhere that we have to do this only for console library projects.

Hope this might help you.

Upvotes: 0

Related Questions