DbProviderServices.GetService(Type, Object) Method

Definition

Called to resolve additional default provider services when a derived type is registered as an EF provider either using an entry in the application's config file or through code-based registration in DbConfiguration. The implementation of this method in this class uses the resolvers added with the AddDependencyResolver method to resolve dependencies.

public virtual object GetService (Type type, object key);
abstract member GetService : Type * obj -> obj
override this.GetService : Type * obj -> obj

Parameters

type
Type

The type of the service to be resolved.

key
Object

An optional key providing additional information for resolving the service.

Returns

An instance of the given type, or null if the service could not be resolved.

Implements

Remarks

Use this method to set, add, or change other provider-related services. Note that this method will only be called for such services if they are not already explicitly configured in some other way by the application. This allows providers to set default services while the application is still able to override and explicitly configure each service if required. See IDbDependencyResolver and DbConfiguration for more details.

Applies to