I am refactoring an existing dotnet core application where in short we have a
- WebApi project
- Business (services) project
- Repositories project
- Datalayer project
Currently, in our webapi project, all other three projects are referenced. This implies also that in controllers, repos and services are injected and used in the controller actions.
I was in the understanding that in Controllers, we only should call services and the service would call the repositories and the repository should use the datalayer.
I am trying to refactor all of this but i want to get rid of the dependency in the WebApi project towards repository project and datalayer project.
The problem is then, when a service is called, the repos and further on the datalayer is not found anymore for further injection.
Am i totally mistaken in my setup i want ? How can I solve this so that for references i have
- WebApi only references Business
- Business only references Repositories
- Repositories only references DataLayer
But i want my DI to keep on working as expected.
Am i expecting the impossible or am i totally confused? Thank to enlighten me.