Share via


DbConfiguration.SetProviderServices(String, DbProviderServices) Method

Definition

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

protected internal void SetProviderServices (string providerInvariantName, System.Data.Entity.Core.Common.DbProviderServices provider);
member this.SetProviderServices : string * System.Data.Entity.Core.Common.DbProviderServices -> unit
Protected Friend Sub SetProviderServices (providerInvariantName As String, provider As DbProviderServices)

Parameters

providerInvariantName
String

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

provider
DbProviderServices

The provider instance.

Remarks

Note that the provider is both registered as a service itself and also registered as a default resolver with a call to AddDefaultResolver. This allows EF providers to act as resolvers for other services that may need to be overridden by the provider. 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 resolver for DbProviderServices and also using AddDefaultResolver to add the provider as a default resolver. 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