Question

I can't get working EF with my Oracle DB, on Visual Studio 2013, .NET 4.0.

This is what i have done:

  • Installed ODTwithODAC121012 (I also have installed previously ODAC1120320_x64)
  • Set up a new connection successfully
  • Generated an edmx rom my DB successfully (I have choosen EF5)

This is my app.config :

   <configSections>
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
   </configSections>
   <connectionStrings>
     <add name="Entities" connectionString="metadata=res://*/Entity.PVModel.csdl|res://*/Entity.PVModel.ssdl|res://*/Entity.PVModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;data source=BWKBX;password=BWKBX;persist security info=True;user id=BWKBX&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
   </entityFramework>

In my code, when I could instantiate my DbContext but I can't run a query like :

    db.MY_TABLE_SET.Where(p => p.FOO == "FOO").ToList();

This is the error I get :

    System.ArgumentException was unhandled by user code
      HResult=-2147024809
      Message=Soit le fournisseur de magasins spécifié est introuvable dans la configuration, soit il n'est pas valide.
      Source=System.Data.Entity
      StackTrace:
           à System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
           à System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
           à System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
           à System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
           à System.Data.Entity.Internal.LazyInternalConnection.Initialize()
           à System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
           à System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
           à System.Data.Entity.Internal.InternalContext.Initialize()
           à System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
           à System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
           à System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
           à System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
           à System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
           à OBS.SCAV.AdminKpiBox.Tests.TestVisualizeService.TestOneEnd() dans d:\Workspace\SCAV\G1R1 (DEV)\Web Service\AdminKpiBox\OBS.SCAV.AdminKpiBox.Tests\TestPeriodValidation.cs:ligne 30
      InnerException: System.ArgumentException
          HResult=-2147024809
          Message=Le fournisseur de données .Net Framework demandé est introuvable. Il n'est peut-être pas installé.
          Source=System.Data.Entity
          StackTrace:
               à System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
          InnerException: 

Thank you in advance.

Was it helpful?

Solution

You may have better luck searching once you know what the error is in english:

"The specified store provider cannot be found in the configuration, or is not valid"

Also, "Unable to find the requested .Net Framework Data Provider. It may not be installed."

Make sure you installed properly. If your application target is 32-bit, make sure that the configure.bat that was run was for 32 bit.. if it was 64 bit make sure to run the configure.bat for 64-bit. Please understand that Oracle.DataAccess.Client is unmanaged, meaning that the "bitness" matters.

OTHER TIPS

I finally found out.

I don't know why but it seems that an Oracle installer (or another) did not register the DbProviderFactory needed by EF in my machine.config, inside the x64 folder (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config).

But it was registered inside the x86 folder (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config). I just copy/paste the line from the x86 file to the x64 file.

The location in the file is :

    <system.data>
        <DbProviderFactories>
          <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
          [...]
       </DbProviderFactories>
    </system.data>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top