Attendance Dependency Injection
Summary
Program.cs is the composition root and registers service dependencies with ASP.NET Core dependency injection.
Audience
Backend developers, architects, and QA engineers.
Reference Content
Scoped registrations include tenant context, DbContext, repository implementations, unit of work, audit/timeline writers, policy resolver, attendance commands/queries, punch and reopen workflows, profile and snapshot services, and shift-policy services. The Payroll lock port is a typed HTTP client. The outbox relay is a hosted singleton lifecycle component that creates scopes for each processing iteration.
Shared messaging registers broker and publisher services as singletons and the outbox processor as scoped. Authentication, authorization, Swagger, health checks, HTTP context access, and shared observability are registered in the composition root. EF Core uses the service's PostgreSQL provider. Shared Kernel and Contracts are project references, not dynamically discovered plug-ins.
No assembly-scanned handler framework, MediatR registration, custom validator registration, or dedicated calculator service registration exists because AttendanceCalculator is stateless and invoked directly. Lifetimes should be preserved when extending the service: DbContext-backed adapters and use-case services are request-scoped, while broker infrastructure and hosted processing have application lifetimes.
Source References
microservices/src/attendance-service/Program.csmicroservices/src/attendance-service/Application/Common/Abstractions.csmicroservices/src/attendance-service/Infrastructure/Persistence.csmicroservices/src/shared-kernel/Extensions/MessagingExtensions.cs
Related Articles
See Also
Keywords
- Attendance Service
- Attendance Dependency Injection
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly