DryIoc
DryIoc copied to clipboard
[MS.DI] ISupportRequiredService is expected to be implemented together with IServiceProvider and not as capability
Currently, MS.DI GetRequiredService
is implemented as extension method as following:
public static object GetRequiredService](this IServiceProvider provider, Type serviceType)
{
if (provider is ISupportRequiredService requiredServiceSupportingProvider)
{
return requiredServiceSupportingProvider.GetRequiredService(serviceType);
}
object? service = provider.GetService(serviceType);
if (service == null)
{
throw new InvalidOperationException(SR.Format(SR.NoServiceRegistered, serviceType));
}
return service;
}
But DryIocAdapter implements it as in the separate DryIocServiceProviderCapabilities
so it would never be requested as GetService<ISupportRequiredService>()
.
Possible with #494.
done