DbConfiguration.SetProviderFactory(String, DbProviderFactory) Method

Definition

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

protected internal void SetProviderFactory (string providerInvariantName, System.Data.Common.DbProviderFactory providerFactory);
member this.SetProviderFactory : string * System.Data.Common.DbProviderFactory -> unit
Protected Friend Sub SetProviderFactory (providerInvariantName As String, providerFactory As DbProviderFactory)

Parameters

providerInvariantName
String

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

providerFactory
DbProviderFactory

The provider instance.

Remarks

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.

Applies to