I'm working on a pet project to practice my .NET Core. I'm using a Web Application project with built-in Dependency Injection framework like so
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IProductRepository, ProductRepository>();
< ... other code ... >
}
It forces me to add reference to my Data project which contains the implementation of the ProductRepository to my WebApplication project. This will mean later on that WebApplication project will need to reference every other project and can abuse that - I don't even want Web to know about repositories, everything should be done via services.
My question is - can I avoid referencing every other project in WebApplication using built-in DI?
(I know I can use other DI containers that will allow to fix this).