DbProviderFactory Class
.NET Framework 4
Represents a set of methods for creating instances of a provider's implementation of the data source classes.
Namespace:
System.Data.Common
Assembly: System.Data (in System.Data.dll)
The DbProviderFactory type exposes the following members.
| Name | Description | |
|---|---|---|
|
CanCreateDataSourceEnumerator | Specifies whether the specific DbProviderFactory supports the DbDataSourceEnumerator class. |
| Name | Description | |
|---|---|---|
|
CreateCommand | Returns a new instance of the provider's class that implements the DbCommand class. |
|
CreateCommandBuilder | Returns a new instance of the provider's class that implements the DbCommandBuilder class. |
|
CreateConnection | Returns a new instance of the provider's class that implements the DbConnection class. |
|
CreateConnectionStringBuilder | Returns a new instance of the provider's class that implements the DbConnectionStringBuilder class. |
|
CreateDataAdapter | Returns a new instance of the provider's class that implements the DbDataAdapter class. |
|
CreateDataSourceEnumerator | Returns a new instance of the provider's class that implements the DbDataSourceEnumerator class. |
|
CreateParameter | Returns a new instance of the provider's class that implements the DbParameter class. |
|
CreatePermission | Returns a new instance of the provider's class that implements the provider's version of the CodeAccessPermission class. |
|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
|
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Factory can be registered in app/web.config
Add this to your config file to register a factory:
$0$0
$0
$0
$0<system.data>
<DbProviderFactories>
<add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.2.30, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>$0
$0
- 1/26/2012
- Doug Clutter
Sigleton
Certain applications (such as SQL Integration Services) require that the implementation of this class be a singleton with the single instance being named 'Instance' with a type of DbProviderFactory.
$0$0
$0
$0Please see the following article to see how to implement a singleton in C#:$0
$0http://msdn.microsoft.com/en-us/library/ff650316.aspx
$0
- 1/15/2012
- Christopher Haws