I am working on an web application (.net core 2.2) and trying to replace existing dependency over an querystring parameter in controller. I know, it is possible to replace dependency inside Startup.cs (ConfigureServices(IServiceCollection services) method). But problem is I cant access "IServiceCollection " in controller. Do you guys have an idea how to achive it?
This is the way to replace dependency in Startup. "ServiceCollectionDescriptorExtensions" has "Replace" method.
services.Replace(ServiceDescriptor.Scoped<IFooService,AnotherVersionOfFooService>());
Thanks