The dependency inversion principle states:
High-level modules should not be dependent on low-level modules. Both should depend on abstractions.
In other words, every module that it depends on (so everything except the entry point modules in your application) should be abstracted. Otherwise, the high-level module must directly depend on the low-level module, causing a DIP violation.
DIP, - . .
, , , , :
.
, , , , . ( ), , , .
, :
- ICommandHandler <TCommand> , ( ).
- IQueryHandler < TQuery, TResult > , ( , -, -) .
- IValidator <T> ,
- ISecurityValidator <T> , , .
- IAuthorizationFilter <T> , .
- IEventHandler <T> , , .
. , .
, , , . 90% 98% ( , , ).
DI (, , .NET), , , . , , . , .