Whenever there is a new dependency identified, we need to declare it into ConfigureServices
method of Startup
class. By the time I have added more than 30 such services and it keep on increasing by time. This is where we see volition of Open/Closed Principle.
Please suggest a solution this violation.
public void ConfigureServices(IServiceCollection services)
{
services.AddRepository<SqlContext>(Configuration);
services.AddHttpContextAccessor();
services.RegisterHttpClients(Configuration);
services.AddSwaggerGen(Configuration);
services.AddCors(Configuration);
services.AddAuthorization(Configuration);
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc(Configuration);
services.AddApiVersioning(Configuration);
services.TryAddSingleton<IActionContextAccessor, ActionContextAccessor>();
.
.
.
.
.
.
}