How bobx5/2024_.net_conf_cleanarchitecture works
Project Type Analysis
This is a .NET-based application that demonstrates the migration from a traditional architecture to Clean Architecture. The project is specifically a Library Management System with clear domain boundaries.
Main Architectural Components
A. Layered Structure (Outside-In):
• Presentation Layer (05. Presentation)
• Infrastructure Layer (04. Infrastructure)
• Application Layer (03. Application)
• Domain Layer (02. Domain)
• Shared Layer (01. Shared)
B. Core Components:
1. Domain Aggregates:
• Books
• Users
• Rents
2. Infrastructure Services:
• DateTimeProvider
• EmailService
• Persistence Layer with Caching
• Outbox Pattern Implementation
Outer Layer (Presentation):
• API Controllers (Books, Rents, Users)
• Middleware Components
Infrastructure Layer:
• Persistence (Database)
• Email Service
• DateTime Provider
• Cached Repositories
Application Layer:
• Use Cases (Commands/Queries)
• Behaviors
• Interfaces
Domain Layer (Core):
• Aggregates (Books, Users, Rents)
• Domain Events
• Value Objects
• Entities
Key Elements to Highlight
a. Dependencies:
• How outer layers depend on inner layers
• How infrastructure implements interfaces defined in application layer
b. Cross-Cutting Concerns:
• How logging and validation behaviors are implemented
• Outbox pattern for event handling
• Caching mechanism in repositories
c. Data Flow:
• API endpoints → Use Cases → Domain Logic
• Domain Events → Event Handlers → Infrastructure Services