Hi,
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.
Thanks.
Ramana
Extending devart's oracle factory and connection classes
-
- Posts: 14
- Joined: Thu 28 Jan 2010 17:13
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
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=1.0.0.0, Culture=neutral, PublicKeyToken=e2bf3be94404398e" with a class:
So you have to add the foolowing information to a config file (App.config or machine.config):
Then you can create and use your provider:
Let's consider that you have an assembly "Customer.dll, version=1.0.0.0, Culture=neutral, PublicKeyToken=e2bf3be94404398e" with a class:
Code: Select all
public class CustomerProviderFactory : OracleProviderFactory
{
public new static CustomerProviderFactory Instance = new CustomerProviderFactory();
}
Code: Select all
<system.data>
<DbProviderFactories>
<remove invariant="Customer" />
<add name="Customer Provider" invariant="Customer"
description="New Customer Provider"
type="Customer.CustomerProviderFactory, Customer,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=e2bf3be94404398e" />
</DbProviderFactories>
</system.data>
Code: Select all
DbProviderFactory fact = DbProviderFactories.GetFactory("Customer");
DbConnection conn = fact.CreateConnection();
conn.Open();
conn.Close();