Repository and Unit of Work
Summary
Payroll does not implement Payroll-specific repository ports; application services query PayrollDbContext directly and use its save operation as the unit-of-work boundary.
Audience
Backend and frontend developers, QA and DevOps engineers, support and security engineers, and solution architects.
Overview
Payroll does not implement Payroll-specific repository ports; application services query PayrollDbContext directly and use its save operation as the unit-of-work boundary.
Technical Detail
Repository model
No aggregate repository interfaces or concrete repository classes are present. Application services use EF Core sets for aggregate retrieval, projection access, filtering, ordering, grouping, and DTO projection.
Read behavior
Many service queries explicitly bypass global filters and then apply tenant predicates. Query endpoints sometimes project directly; tracked entity loading is used for mutations. No-tracking behavior is not consistently or explicitly requested.
Save and transaction semantics
A SaveChangesAsync call commits all tracked changes for calculation, freeze, unfreeze, or payslip persistence. Explicit transaction scopes are absent in these services. Multiple report/output methods perform a subsequent audit save.
Cross-entity validation
Application services validate run state, details, advance balances, and tenant/period relationships before saving. Database indexes provide additional uniqueness enforcement. Concurrency tokens and retry policies are not confirmed.
Source References
microservices/src/payroll-service/Application/PayrollCalculationService.csmicroservices/src/payroll-service/Application/PayrollOutputsService.csmicroservices/src/payroll-service/Application/PayrollCompatService.csmicroservices/src/payroll-service/Infrastructure/PayrollDbContext.csmicroservices/src/payroll-service/Infrastructure/Persistence.cs
Related Articles
See Also
Keywords
- Payroll Service
- Repository and Unit of Work
- Technical architecture
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly