Unable to determine the DbProviderFactory

Unable to determine the DbProviderFactory

Postby meltin1982 » Tue 02 Sep 2014 14:29


it seems nobody had this problem before, so I hope annybody can help. So thanks in advance.


console app,
entity framework 6.0.2 (same error with 6.1.1)

I need to implement a new Devart.Data.Oracle.OracleConnection.

Code: Select all
public class MyNewConnection: Devart.Data.Oracle.OracleConnection

My Config looks like this:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
        <parameter value="v11.0"/>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
      <provider invariantName="Devart.Data.Oracle" type="Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity, Version=, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    <add name="Entities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=Devart.Data.Oracle;provider connection string=&quot;user id=***;password=***;server=***;home=OraHome11gP4_Client32;persist security info=True&quot;" providerName="System.Data.EntityClient" />
      <remove invariant="Devart.Data.Oracle" />
      <add name="dotConnect for Oracle" invariant="Devart.Data.Oracle" description="Devart dotConnect for Oracle" type="Devart.Data.Oracle.OracleProviderFactory, Devart.Data.Oracle, Version=, Culture=neutral, PublicKeyToken=09af7300eec23701" />

and then the code based registration, because without these lines, the connection will not work.

Code: Select all
public class Configuration : DbConfiguration
   public Configuration()
            SetProviderServices("Devart.Data.Oracle", new Devart.Data.Oracle.Entity.OracleEntityProviderServices());
            SetProviderFactory("Devart.Data.Oracle", Devart.Data.Oracle.OracleProviderFactory.Instance);

Now I cretae a new connection, in this way:

Code: Select all
private Entities _Entities;
private static MetadataWorkspace _Workspace = new MetadataWorkspace(
   new[] { "res://*/Model.csdl", "res://*/Model.ssdl", "res://*/Model.msl" },
   new[] { typeof(Entities).Assembly });
public ...()
   OracleConnection connection = new OracleConnection
      ConnectionString = "Data Source=**;User ID=***;password=***;",

   EntityConnection entityConnection = new EntityConnection(_Workspace, connection);
   _Entities = new Entities(entityConnection);

and it works really fine.

If I change now:

Code: Select all
OracleConnection connection = new OracleConnection
   ConnectionString = "Data Source=**;User ID=***;password=***;",


Code: Select all
MyNewConnection connection = new MyNewConnection
   ConnectionString = "Data Source=**;User ID=***;password=***;",

I get the errormessage:

Unable to determine the DbProviderFactory type for connection of type 'MyNewConnection'. Make sure that the ADO.NET provider is installed or registered in the application config.

In devart we have no possibility with multithreading, so I need to implement a new connection. The problem is, that if a thread closed, the connection is closed too. And if multiple threads holds one connection, they cannot use it anymore.
With EF 4 my "own" implemented Connection works fine. With EF 6 it doesnt. Can anybody help?
Posts: 1
Joined: Tue 02 Sep 2014 14:06

Re: Unable to determine the DbProviderFactory

Postby Shalex » Mon 08 Sep 2014 13:28

I cannot reproduce the problem with dotConnect for Oracle v8.4.239 (the latest build) and EntityFramework v6.1.1 (ObjectContext template).
Please send us a small test project to reproduce "Unable to determine the DbProviderFactory type for connection of type 'MyNewConnection'" in our environment.
Devart Team
Posts: 7946
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for Oracle