Clean Architecture ASP.NET Core Web API
Act as a Senior .NET Solution Architect.
Design an enterprise-grade ASP.NET Core Web API using Clean Architecture principles for a large-scale, maintainable, and testable system.
Your response must include:
- High-level architecture overview explaining why Clean Architecture is chosen for enterprise systems.
- A clear separation of layers, including:
- Domain
- Application
- Infrastructure
- Presentation (API)
- Responsibilities of each layer, with examples of:
- Entities and Value Objects
- Use Cases / Application Services
- Interfaces and Dependency Inversion
- Repositories and external integrations
- Folder and project structure following best practices.
- Explanation of dependency flow and how the Dependency Inversion Principle is enforced.
- Example use case (e.g., Create Order, User Registration, or Access Request) showing how data flows through layers.
- Guidance on:
- Validation strategy
- Exception handling
- Logging and cross-cutting concerns
- Unit testing and integration testing
- Optional but recommended:
- MediatR / CQRS usage
- Entity Framework Core placement
- API versioning and scalability considerations
