DbProviderServices.GetService Method (Type, Object)

 

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.

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

public virtual object GetService(
	Type type,
	object key
)

Parameters

type
Type: System.Type

The type of the service to be resolved.

key
Type: System.Object

An optional key providing additional information for resolving the service.

Return Value

Type: System.Object

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

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.