SingletonDependencyResolver<T>.GetService Method (Type, Object)

 

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.

Namespace:   System.Data.Entity.Infrastructure.DependencyResolution
Assembly:  EntityFramework (in EntityFramework.dll)

public object GetService(
	Type type,
	object key
)

Parameters

type
Type: System.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.

key
Type: System.Object

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

Return Value

Type: System.Object

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