Entity Framework Oracle Connection String

c# entity-framework oracle visual-studio-2010

Question

I need help with this connection string I am using. First a little background: I set up another PC with the XE version of Oracle. This PC is connected to a hub, which my PC is connected to as well. I also added this PC to my computers tnsnames.ora file for Oracle and it the entry looks like this...

EF1DEV.TEST.SERVER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = testcomputername.my.test.dom)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = xe)
    )
  )

I then went into visual studio 2010 and Generated a Model (.edmx) from an existing database using TNS and the tnsnames entry I added, and it worked fine. The connection string was generated in the app.config file for the project and it looks like this.

<add name="Test_Entities" connectionString="metadata=res://*/TestDatabase.csdl|res://*/TestDatabase.ssdl|res://*/TestDatabase.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=EF1DEV.TEST.SERVER;PASSWORD=hr;USER ID=HR&quot;" providerName="System.Data.EntityClient" />

The issue is when I try to actually use my model in code. Like This:

using(Test_Entities testEnt = new Test_Entities())
{
}

I get an exception that says [System.ArgumentException] = "The specified store provider cannot be found in the configuration, or is not valid."

And the inner exception says InnerException = "Unable to find the requested .Net Framework Data Provider. It may not be installed."

Any thoughts as to whats going wrong?

1
0
4/7/2014 6:07:39 PM

Accepted Answer

In order to use Oracle as a provider you need to download and add the oracle ODAC package

You may want to review the tutorials located at Building .NET Applications Using Oracle Developer Tools for Visual Studio which will walk you through the required steps.

Basically the steps are:

  • Download and install ODAC.
  • Add Oracle.DataAccess and Oracle.ManagedDataAccess references to your project
2
4/11/2014 3:51:03 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow