Attendance Repository and Unit of Work
Summary
Domain repository ports are implemented by EF Core adapters sharing one scoped DbContext and unit of work.
Audience
Backend developers, architects, and QA engineers.
Confirmed behavior
Ports exist for attendance, punches, reopen requests, employee profiles, payroll snapshots, shifts, weekly offs, policies, and employee shift assignments. Aggregate retrieval is tracked so domain mutation is persisted. Query ports expose IQueryable; application queries add tenant-filtered predicates, ordering, projections, and AsNoTracking where confirmed.
The unit of work calls one asynchronous SaveChanges operation. That commit includes tracked aggregate changes, audit/timeline additions, and outbox rows mapped from queued domain events. Broker publication and Payroll HTTP calls are outside this database transaction. No explicit multi-step transaction API is present in normal application services.
Cross-entity validation is performed before commit: employee/profile checks, weekly-off lookup, shift existence/activity, assignment overlap, default-policy rules, and pending reopen uniqueness. Some invariants are also backed by persistence uniqueness; others remain application-enforced. Repository queryability couples the application layer to EF-style query semantics and should be considered when testing or replacing persistence.
Source References
microservices/src/attendance-service/Domain/Repositories.csmicroservices/src/attendance-service/Application/Common/Abstractions.csmicroservices/src/attendance-service/Infrastructure/Persistence.csmicroservices/src/attendance-service/Infrastructure/AttendanceDbContext.cs
Related Articles
See Also
Keywords
- Attendance Service
- Attendance Repository and Unit of Work
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly