Tuesday, December 25, 2018

Depdency Flow in Onion Arch


UI and Testing Projects Call the Application Services. So, UI or Testing Projects can make Hard Code Calls to the Application Services or they Make Polymorphic call to he Application Services and use DI/IOC to inject the Application Services to the UI or Testing projects. UI and Testing is just hanging projects like Appendix those can be deferred or those can be replaced later on without effecting the rest of the Application.

Application Services are injected to the UI or Testing Classes by DI/IOC container

Application Service needs to call different Infrastructure Projects to get work done. One such project is calling the Repository Classes to Persist the Domain Data. All this infrastructure should be loosely hooked to the Application Services so that it could be Mocked/Replaced/Deferred. So, Domain Model or Application Service Project defines the Interfaces for the Infrastructure Projects. Infrastructure Projects implement these interfaces in separate Project. These hard implementations are injected to the Application Services by DI/IOC container.

Infrastructure Services are injected to the Application Services by DI/IOC container

No comments:

Post a Comment