Employee Layered Architecture
Summary
The service separates presentation, application coordination, domain behavior, infrastructure adapters, persistence, and host configuration while keeping them in one executable project.
Audience
- Backend developers
- QA engineers and solution architects
Purpose
Use this dependency model to place new code without reversing domain boundaries or coupling application logic to infrastructure details.
Layer responsibilities
| Layer | Confirmed responsibility |
|---|---|
| Presentation | Bind requests, invoke application services or CQRS handlers, and translate results. Detailed routes are deferred. |
| Application | Define commands, queries, handlers, DTOs, mappings, validation, search contracts, audit/unit-of-work ports, and use-case coordination. |
| Domain | Define aggregate consistency boundaries, entities, value objects, invariants, domain events, and repository ports. |
| Infrastructure | Implement repositories, tenant context, search, audit, unit of work, outbox store, and EF Core integration. |
| Persistence | Implemented inside Infrastructure through the context, repositories, migrations, no-tracking queries, and transactional save behavior. |
| Configuration | Implemented in the composition root and host configuration; supplies persistence, token validation, messaging, observability, startup, and health categories. |
Layer dependencies
Domain code does not reference presentation, infrastructure, EF Core, or shared integration contracts. The web project physically contains every layer, so the dependency rule is a namespace/source convention rather than separate project enforcement.
Source References
microservices/src/employee-service/Api/microservices/src/employee-service/Application/microservices/src/employee-service/Domain/microservices/src/employee-service/Infrastructure/microservices/src/employee-service/Program.cs
Related Articles
See Also
Keywords
- Dependency direction
- Layer responsibilities
- Separation of concerns
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly