DbConfiguration.SetProviderFactory Method (String, DbProviderFactory)

 

Call this method from the constructor of a class derived from DbConfiguration to register an ADO.NET provider.

Namespace:   System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

protected internal void SetProviderFactory(
	string providerInvariantName,
	DbProviderFactory providerFactory
)

Parameters

providerInvariantName
Type: System.String

The ADO.NET provider invariant name indicating the type of ADO.NET connection for which this provider will be used.

providerFactory
Type: System.Data.Common.DbProviderFactory

The provider instance.

This method is provided as a convenient and discoverable way to add configuration to the Entity Framework. Internally it works in the same way as using AddDependencyResolver to add an appropriate resolvers for DbProviderFactory and IProviderInvariantName. This means that, if desired, the same functionality can be achieved using a custom resolver or a resolver backed by an Inversion-of-Control container.