Roadmap › SOLID Principles with Examples › Module: Related Principles
Lessons in this course (8)
8. SOLID in a layered / Clean Architecture solution
AdvancedMediumLesson 8 of 8
src/
Shop.Domain/ entities, value objects, domain interfaces (no dependencies)
Shop.Application/ use cases, IOrderRepository, IEmailSender (→ Domain)
Shop.Infrastructure/ EF Core repos, SMTP sender, Azure Blob (→ Application)
Shop.Api/ controllers, DI composition root (→ Application, Infrastructure)- DIP:
ApplicationdefinesIOrderRepository;Infrastructureimplements it. Dependencies point inwards. - SRP: one handler per use case (
PlaceOrderHandler), e.g. with MediatR or plain classes. - OCP: cross-cutting concerns as decorators/pipeline behaviours (logging, validation, caching) without editing handlers.
- ISP: small ports (
IClock,ICurrentUser,IFileStore). - LSP: every
IFileStore(local, Azure Blob, S3) behaves the same for callers.