Payroll Run Aggregate
Summary
PayrollRun is the lifecycle root for a tenant and period, with employee details, totals, freeze metadata, lifecycle audit, and integration events coordinated by the calculation service.
Audience
Backend and frontend developers, QA and DevOps engineers, support and security engineers, and solution architects.
Overview
PayrollRun is the lifecycle root for a tenant and period, with employee details, totals, freeze metadata, lifecycle audit, and integration events coordinated by the calculation service.
Technical Detail
Responsibility and identity
A run belongs to a tenant and a PayrollPeriod and carries its own identity, month, year, status, aggregate gross, aggregate deductions, aggregate net, and freeze metadata. Employee outcomes reference the run.
Lifecycle and restrictions
Calculation creates or replaces details for an editable run. Any frozen run for the same tenant and period blocks recalculation. Freeze requires details and an allowed source state; unfreeze requires Frozen. Direct flow uses Draft, Calculated, Frozen, and Unfrozen.
Transaction boundary
Each calculation, freeze, or unfreeze orchestration stages run/detail changes, audit/timeline entries, advance side effects where applicable, and an outbox record before one SaveChangesAsync call. A separately opened explicit database transaction is not present.
Invariants and limitations
No separate approval or irreversible-finalization state is implemented. Compatibility unfreeze returns records to Draft while the native flow uses Unfrozen; this is Transitional.
Source References
microservices/src/payroll-service/Domain/PayrollEntities.csmicroservices/src/payroll-service/Application/PayrollCalculationService.csmicroservices/src/payroll-service/Infrastructure/PayrollDbContext.csmicroservices/src/contracts/Events/PayrollCalculatedEvent.cs
Related Articles
See Also
Keywords
- Payroll Service
- Payroll Run Aggregate
- Technical architecture
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly