addKeyedScoped<TService> method

ServiceCollection addKeyedScoped<TService>(
  1. Object? serviceKey,
  2. KeyedImplementationFactory implementationFactory
)

Adds a keyed scoped service of the type specified in TService with a factory specified in implementationFactory to the specified ServiceCollection.

Implementation

ServiceCollection addKeyedScoped<TService>(
  Object? serviceKey,
  KeyedImplementationFactory implementationFactory,
) {
  final descriptor = ServiceDescriptor.keyedScoped<TService>(
    serviceKey,
    (services) => implementationFactory,
  );
  add(descriptor);
  return this;
}