Imagine I have four projects in my solution:
- UI <- startup project
- Domain
- Repository
- Boot
The UI
projects has dependencies to the Domain
and Boot
projects.
The Boot
project has dependencies to the Domain
and Repository
projects for DI container configurations.
If I write this in ASP.NET Core 5, the UI
code can access and instantiate Repository
classes, even if I didn't have a dependency in the UI
project.
In .NET Framework 4.8, this did not happen. This behavior turn an isolation impossible, so Dependency Inversion Principle in this configuration is easily breakable.
There is a way to turn that behavior off in ASP.NET Core 5?