1
votes

I am building Asp.net core mvc application and trying to use clean architecture. We know that in DDD and in onion architecture UI layer should not depend on infrastructure layer and persistence layer. I can't fully understand this concept because if I won't reference infrastructure layer and persistence layer from UI Layer which is my asp.net core mvc application how I can register concrete implementations on abstractions in IOC container in startup class?

1
Sure it has to depend on them: it just doesn't have to care how they're implemented. - mason
Real world example: You can fill your car at the gas station even when it is just built and you car is more than 10 years old, and you do not have to ask how they have built it. - Sir Rufo

1 Answers

2
votes

What does it mean when applications one layer is not dependent on another

enter image description here

In practice, it means that we should be able to replace an outer circle without requiring changes to the inner circles.

In Uncle Bob's specific example, I should be able to replace the Controller and the Presenter without also needing to change the Use Cases.

Your startup class, aka the Composition Root, is responsible for wiring together all of the different pieces so that they can communicate with each other.

See also: Boundaries, by Gary Bernhardt.