Creates a new ServiceScope. Scoped services resolved from the scope's serviceProvider are cached per-scope and disposed when the scope is disposed.
The returned scope implements both Symbol.dispose and
Symbol.asyncDispose, so it works with the using keyword:
A new ServiceScope.
Resolves a service by its schema key.
validateScopes is true (default). Use
createScope to obtain a scoped provider.The schema instance used as the service identifier. Must be the same reference used during registration.
The resolved service, typed as InferType<typeof schema>.
Resolves a service by its schema key, or returns undefined if the
schema is not registered.
Unlike get, this method does not throw for unregistered schemas. All other behaviour (lifetime, scope validation, circular dependency detection) is the same.
The schema instance used as the service identifier.
The resolved service or undefined.
Resolves the dependencies described by a FunctionSchemaBuilder
and calls implementation with the resolved values.
Each parameter schema in funcSchema.introspect().parameters is
resolved from this provider. The implementation receives the resolved
values in the same order as the parameter schemas.
A FunctionSchemaBuilder whose parameters describe the services to inject.
A function whose parameters match the
funcSchema parameter types and whose return type matches the
funcSchema return type.
The return value of implementation.
An immutable service provider that resolves services from a frozen set of descriptors. Obtain an instance by calling ServiceCollection.buildServiceProvider.
Supports three service lifetimes:
Example: Resolving services
Example: Using scopes
Example: Function injection
See