SingletonDependencyResolver<T> Class

Definition

Implements IDbDependencyResolver to resolve a dependency such that it always returns the same instance.

public class SingletonDependencyResolver<T> : System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver where T : class
type SingletonDependencyResolver<'T (requires 'T : null)> = class
    interface IDbDependencyResolver
Public Class SingletonDependencyResolver(Of T)
Implements IDbDependencyResolver

Type Parameters

T

The type that defines the contract for the dependency that will be resolved.

Inheritance
SingletonDependencyResolver<T>
Implements

Remarks

This class is immutable such that instances can be accessed by multiple threads at the same time.

Constructors

SingletonDependencyResolver<T>(T, Func<Object,Boolean>)

Constructs a new resolver that will return the given instance for the contract type if the given key matches the key passed to the Get method based on the given predicate.

SingletonDependencyResolver<T>(T, Object)

Constructs a new resolver that will return the given instance for the contract type if the given key matches exactly the key passed to the Get method.

SingletonDependencyResolver<T>(T)

Constructs a new resolver that will return the given instance for the contract type regardless of the key passed to the Get method.

Methods

GetService(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.

GetServices(Type, Object)

Attempts to resolve a dependencies for a given contract type and optionally a given key. If the resolver cannot resolve the dependency then it must return an empty enumeration and not throw. This method differs from GetService(Type, Object) in that it returns all registered services for the given type and key combination.

Extension Methods

GetService(IDbDependencyResolver, Type)

Calls GetService(Type, Object) passing the given type argument and using null for the name argument.

GetService<T>(IDbDependencyResolver, Object)

Calls GetService(Type, Object) passing the generic type of the method and the given name as arguments.

GetService<T>(IDbDependencyResolver)

Calls GetService(Type, Object) passing the generic type of the method as the type argument and null for the name argument.

GetServices(IDbDependencyResolver, Type)

Calls GetServices(Type, Object) passing the given type argument and using null for the name argument.

GetServices<T>(IDbDependencyResolver, Object)

Calls GetServices(Type, Object) passing the generic type of the method and the given name as arguments.

GetServices<T>(IDbDependencyResolver)

Calls GetServices(Type, Object) passing the generic type of the method as the type argument and null for the name argument.

Applies to