I am trying to follow clean architecture by uncle bob. I have 3 layers
- Core (Hosts business logic, and is the central layer)
- Application (Host application usecases, and is directly above the core)
I know the responsibility of infrastructure layer is to host any external dependencies that our application needs. But I have few questions about Infrastructure layer.
Does Infrastructure layer is responsible to fulfill interfaces defined in Core only? Or it is supposed to fulfill the interfaces of any other layer that needs external dependency. For example, Application or UI etc.
Infrastructure layer is always depicted as the last layer in onion architecture, then how come it can depend upon the core? Isn’t the layers are supposed to directly depend on the layers immediately below them?
Let’s say I have an interface IExternalDep in the core and I created it’s implementation in the infrastructure layer. Now how can my other layers use this implementation? What is the way to provide the implementation during runtime without directly depending upon the infrastructure, as we know it is the outermost layer.