Employee CQRS
Summary
Employee Service implements CQRS with local marker interfaces and generic handler interfaces. Handlers are resolved directly through dependency injection; no MediatR package, mediator object, reflection dispatcher, or central command bus is present.
Audience
- Backend developers
- QA engineers and solution architects
Purpose
Explain how request handlers reach write and read use cases and where the current CQRS implementation remains transitional.
Command flow
Query flow
Implementation details
- Commands implement
ICommand<TResult>and queries implementIQuery<TResult>. - Scoped handlers implement
ICommandHandlerorIQueryHandlerand exposeHandleAsync. Result<T>distinguishes success, validation, not-found, and conflict outcomes.- Command handlers own validation invocation, mutation, audit, and commit.
- Query handlers use no-tracking/projection-oriented reads and do not commit.
- Cancellation tokens flow through handlers and persistence operations.
Transitional duplication
Typed CQRS handlers coexist with EmployeeCommands and EmployeeQueries application services used by other presentation mappings. No automatic pipeline coordinates both styles. Consolidation and a single dispatcher Require confirmation.
Source References
microservices/src/employee-service/Application/Common/Cqrs.csmicroservices/src/employee-service/Application/Commands/EmployeeApplicationCommands.csmicroservices/src/employee-service/Application/Queries/EmployeeApplicationQueries.csmicroservices/src/employee-service/Application/Employees/Employees.csmicroservices/src/employee-service/Program.cs
Related Articles
See Also
Keywords
- Command handler
- Query handler
- Direct DI dispatch
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly