I am planning to follow onion architecture for my new application.
the solution hierarchy is as follows
- Domain - where all the interfaces for the services and repositories defined.
- Infrastructure - this is the layer where all data access is placed. these classes typically implement interfaces defined in the domain.
- Web - this is my presentation part of the application. inside the same layer, I have a separate folder for implementing the services defined in the domain.
My plan is to use Dependency injection for dependency resolution. Initially, I thought of placing DI-related code in Infrastructure. But the problem is it leads to circular references while I map services Because the actual service implementation is in my web project and the web project is referencing Infrastructure already. I can't move concrete services to another layer because it violates the principles of Onion Architecture ( transitive dependencies).
Any lead is appreciated.