SingletonDependencyResolver<T>.GetService(Type, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
override this.GetService : Type * obj -> obj
Parameters
- 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.
- key
- Object
Optionally, the key of the dependency to be resolved. This may be null for dependencies that are not differentiated by key.
Returns
The resolved dependency, which must be an instance of the given contract type, or null if the dependency could not be resolved.
Implements
Applies to
Entity Framework