Skip to main content

@microsoft/fast-foundation > ResolverBuilder

ResolverBuilder class

A utility class used that constructs and registers resolvers for a dependency injection container. Supports a standard set of object lifetimes.

Signature:
export declare class ResolverBuilder<K> 

Constructors

ConstructorModifiersDescription
(constructor)(container, key)Constructs a new instance of the ResolverBuilder class

Methods

MethodModifiersDescription
aliasTo(destinationKey)Aliases the current key to a different key.
cachedCallback(value)Creates a resolver that invokes a callback function the first time that a dependency resolution is requested. The returned value is then cached and provided for all subsequent requests.
callback(value)Creates a resolver that invokes a callback function for every dependency resolution request, allowing custom logic to return the dependency.
instance(value)Creates a resolver for an existing object instance.
singleton(value)Creates a resolver that enforces a singleton lifetime.
transient(value)Creates a resolver that creates a new instance for every dependency request.