Architecture · Clean Architecture
Dependency inversion: dữ liệu ra ngoài, phụ thuộc vào trong
Dependency inversion giữa Application và Infrastructure
CreateLeadHandler gọi interface ILeadRepository do Application định nghĩa; EfLeadRepository ở Infrastructure cài đặt interface đó và truy vấn SQL Server; Program.cs là composition root duy nhất nối interface với implementation; dữ liệu chảy ra ngoài còn phụ thuộc chỉ hướng vào trong.
VÒNG TRONG · DOMAIN + APPLICATION
VÒNG NGOÀI · API + INFRASTRUCTURE
DÙNG
GỌI
CÀI ĐẶT
NỐI DÂY DI
Lead, Money
Crm.Domain
CreateLeadHandler
Crm.Application
ILeadRepository
port · interface
Program.cs
Crm.Api · composition root
EfLeadRepository
adapter · EF Core
SQL Server
database
Dòng chảy dữ liệu
Application
Database
Dòng chảy phụ thuộc
Application
Infrastructure
CHÚ GIẢI
Phụ thuộc hướng vào trong
Gọi / dùng
Composition root đăng ký DI
Port do vòng trong định nghĩa
© tiennhm