The ASP.NET Core built-in dependency injection mechanism allows to have multiple service registrations to the same interface type:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddScoped<ICustomService, CustomService1>();
services.AddScoped<ICustomService, CustomService2>();
services.AddScoped<ICustomService, CustomService3>();
...
}
While the last service registered get a precedence when the requested service is resolved:
public MyController(ICustomService myService) { }
I'm wandering how can i get the full list of registered services of a given type in my controller constructor eg. ICustomService?