Say I have four Projects. DataRepositories, DataRepositoryInterfaces, SetupInject, WebAPI. I want WebAPI to only have a direct reference to two of those projects. Essentially making WebAPI ignorant to the concrete implementations of my repository interfaces.
To do this I've made it so SetupInjections main purpose is to define the concrete types that will be injected. However, when I reference the InjectionSetup project I get all it's dependencies in the WebAPI project as well.
Although I never referenced the project that defines the concrete classes directly, they are still available for me to use. The main objective is to restrict the developer from making an instance of the class in this project.
I recall being able to do something like this in previous versions of .NET. Is there any way to do this now?
1) Is what I'm trying to do suggested?
2) Can it be done with .Net Core?
3) Why could it be done in previous versions.