Repositories and Persistence
Summary
The extracted service defines repository interfaces in the domain layer and Entity Framework implementations in infrastructure. A unit of work persists aggregates, audit/timeline entries, processed-message records, and domain-event outbox messages.
Audience
Backend and database developers, QA, security reviewers, and solution architects.
Persistence flow
Tenant isolation
Recruitment entities use global tenant filters. Repository operations normally execute through the tenant-aware context. One active-onboarding lookup ignores global query filters and searches by offer identifier plus non-cancelled status. The globally unique identifier reduces accidental collision risk, but the query does not explicitly assert tenant in the inspected implementation and should receive security review.
Monolith exit and onboarding-task entities use the monolith context and its tenant filters. The two stores do not share a transaction.
Outbox behavior
Save operations translate pending domain events to outbox records in the same Recruitment database commit. A hosted relay polls unpublished records and attempts transport publication. Failed attempts are logged and remain an operational concern; this is not proof of exactly-once delivery. Consumer idempotence and processed-message behavior must be evaluated per consumer.
Audit and timeline
Recruitment audit and timeline writers persist application records. HR Operations persists a separate exit audit log. These mechanisms are separate and do not form a unified employee lifecycle ledger.
Requires confirmation
- Explicit tenant assertion for active onboarding lookup.
- Outbox retry, poison-message, retention, and alerting policy in each environment.
- Backup, restore, archival, and regulatory retention requirements.
- Cross-store reconciliation between Recruitment completion and monolith exit history.
Source References
microservices/src/recruitment-service/Domain/Repositories.csmicroservices/src/recruitment-service/Infrastructure/Persistence.csmicroservices/src/recruitment-service/Infrastructure/RecruitmentDbContext.csmicroservices/src/recruitment-service/Messaging/OutboxRelayHostedService.csData/AppDbContext.csModels/ExitRequestAuditLog.cs
Related Articles
See Also
Keywords
- Repository port
- Tenant filtering
- Transactional outbox
Revision Information
- Status: Draft
- Last reviewed: 2026-07-20
- Review cycle: Quarterly