IDbDependencyResolver.GetService(Type, Object) IDbDependencyResolver.GetService(Type, Object) Method


Attempts to resolve a dependency for a given contract type and optionally a given key. If the resolver cannot resolve the dependency then it must return null and not throw. This allows resolvers to be used in a Chain of Responsibility pattern such that multiple resolvers can be asked to resolve a dependency until one finally does.

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


Type Type

The interface or abstract base class that defines the dependency to be resolved. The returned object is expected to be an instance of this type.

Object Object

Optionally, the key of the dependency to be resolved. This may be null for dependencies that are not differentiated by key.


The resolved dependency, which must be an instance of the given contract type, or null if the dependency could not be resolved.

Applies to