Class KeyedServiceResolver
Helper to resolve keyed services from the DI container, and to discover which keys are available for a specific service.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static class KeyedServiceResolver
- Inheritance
-
objectKeyedServiceResolver
Remarks
Added in v22, should still be considered work in progress.
Methods
GetAllKeyedServices<TService>(IServiceProvider)
⚠️ This is an internal API and can change at any time.
It's documented so you see how it works.
⚠️ Do not use it, or anything with
⚠️ Do not use it, or anything with
Sys or Internal namespaces in your code, as future changes could break your code.
Retrieve all keyed services for a given service type. Note that for each key, multiple services could be returned.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static IEnumerable<KeyValuePair<string, TService>> GetAllKeyedServices<TService>(this IServiceProvider provider)
Parameters
providerIServiceProvider
Returns
- IEnumerable<KeyValuePair<string, TService>>
Type Parameters
TService
GetAllKeysForService<TService>(IServiceProvider)
⚠️ This is an internal API and can change at any time.
It's documented so you see how it works.
⚠️ Do not use it, or anything with
⚠️ Do not use it, or anything with
Sys or Internal namespaces in your code, as future changes could break your code.
Retrieve all keys for a given service type. For discovering which keys are available for a specific service.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static IEnumerable<string> GetAllKeysForService<TService>(this IServiceProvider provider)
Parameters
providerIServiceProvider
Returns
Type Parameters
TService
Remarks
It requires that keyed services were registered using the AddKeyedTransientWithMarker<TService, TImplementation>(IServiceCollection, string).
Added in v22