DbProviderFactories.GetFactory Method

Definition

Returns an instance of a DbProviderFactory.

Overloads

GetFactory(DbConnection)

Returns an instance of a DbProviderFactory.

GetFactory(DataRow)

Returns an instance of a DbProviderFactory.

GetFactory(String)

Returns an instance of a DbProviderFactory.

GetFactory(DbConnection)

Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs

Returns an instance of a DbProviderFactory.

C#
public static System.Data.Common.DbProviderFactory? GetFactory(System.Data.Common.DbConnection connection);
C#
public static System.Data.Common.DbProviderFactory GetFactory(System.Data.Common.DbConnection connection);

Parameters

connection
DbConnection

The connection used.

Returns

An instance of a DbProviderFactory for a specified connection.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1

GetFactory(DataRow)

Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs

Returns an instance of a DbProviderFactory.

C#
public static System.Data.Common.DbProviderFactory GetFactory(System.Data.DataRow providerRow);

Parameters

providerRow
DataRow

DataRow containing the provider's configuration information.

Returns

An instance of a DbProviderFactory for a specified DataRow.

Remarks

The providerRow parameter corresponds to the DataRow of a table returned by GetFactoryClasses.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1

GetFactory(String)

Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs
Source:
DbProviderFactories.cs

Returns an instance of a DbProviderFactory.

C#
public static System.Data.Common.DbProviderFactory GetFactory(string providerInvariantName);

Parameters

providerInvariantName
String

Invariant name of a provider.

Returns

An instance of a DbProviderFactory for a specified provider name.

Remarks

The providerInvariantName parameter corresponds to the InvariantName column of a table returned by GetFactoryClasses.

If you pass a value for providerInvariantName that's not valid, an exception is raised with the message, "Unable to find the requested .NET Framework Data Provider. It may not be installed."

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.1