Extending devart's oracle factory and connection classes

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 14
Joined: Thu 28 Jan 2010 17:13

Extending devart's oracle factory and connection classes

Post by ramana.bhavaraju » Fri 24 Feb 2012 10:09


I am trying to extend devart's OracleProviderFactory and OracleConnection classes, as i need to provide my own implementation on how i handle closing of connections (due to the way we do multi threading in the application) by overriding the close method of the connection class. So can you please let me know how do i register my custom factory to the Dbfactories collection, as it looks like my factory class is not getting loaded with the providername = "customerassemblyname"in the connection string.


Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Thu 01 Mar 2012 14:30

You have to add your provider to the application config file (App.config - local settings) or to the machine.config file (global settings).
Let's consider that you have an assembly "Customer.dll, version=, Culture=neutral, PublicKeyToken=e2bf3be94404398e" with a class:

Code: Select all

public class CustomerProviderFactory : OracleProviderFactory
    public new static CustomerProviderFactory Instance = new CustomerProviderFactory();
So you have to add the foolowing information to a config file (App.config or machine.config):

Code: Select all

    <remove invariant="Customer" />
    <add name="Customer Provider" invariant="Customer"
     description="New Customer Provider"
     type="Customer.CustomerProviderFactory, Customer,
       Version=, Culture=neutral, PublicKeyToken=e2bf3be94404398e" />
Then you can create and use your provider:

Code: Select all

DbProviderFactory fact = DbProviderFactories.GetFactory("Customer");
DbConnection conn = fact.CreateConnection();

Post Reply