src/Zop/Extensions/DependencyInjection/KeyedServiceProviderExtensions.cs
/// <summary>
/// Acquire a service by key.  Throws KeyNotFound exception if key is not found.
/// </summary>
Acquire a service by key.  Throws KeyNotFound exception if key is not found.
Acquire a service by key . Throws KeyNotFound exception if key is not found .
public static TService GetRequiredServiceByKey<TKey, TService>(this IServiceProvider services, TKey key)
            where TService : class
        {
            return services.GetServiceByKey<TKey, TService>(key) ?? throw new KeyNotFoundException(key?.ToString());
        }
public static TService GetRequiredServiceByKey < TKey , TService > ( this IServiceProvider services , TKey key ) where TService : class { return services . GetServiceByKey < TKey , TService > ( key ) ?? throw new KeyNotFoundException ( key ? . ToString ( ) ) ; }
Acquire a service by key.
Acquire a service by key .
IServiceProvider
this
key
TKey