I've seen a ton of examples of how to do DI, and the example always shows two dependencies. But what about when you have 50 or 100 dependencies (or more) in a large-ish application? The Program.cs file will get unwieldy with 100+ lines of builder.Services.AddScoped<IDependency1, Dependency1>();
, not to mention problems where multiple developers are adding new dependencies and their branches conflict.
Does it make sense to have another file/method for these dependencies, so people aren't all modifying Program.cs? Something like,
AddDependencies(builder.Services);
//another file for this
public void AddDependencies(IServiceCollection services)
{
services.AddScoped<IDependency1, Dependency1>();
}
Or is there something else entirely that addresses this kind of thing?