Skip to main content

Leave Database Overview

Summary

LeaveDbContext is the runtime and design-time EF Core model for all 12 Leave-owned and operational persisted objects.

Audience

Backend developers, QA, architects, DevOps engineers, and support engineers.

Overview

The service registers the PostgreSQL provider and uses code-first migrations. Repositories expose tracked DbSets, while UnitOfWork delegates to a single SaveChanges call. Before the EF save, aggregate domain events are converted into outbox records, allowing aggregate state and newly created outbox messages to participate in the same database commit.

The model includes Leave requests, balances, configuration, calendars, an Employee projection, carry-forward and encashment Foundation records, audit/timeline history, and an outbox. No processed-event or inbox table exists in LeaveDbContext; Employee projection idempotency is stored on the profile itself.

AreaVerified behaviorSource
Provider/modelPostgreSQL EF Core code-firstmicroservices/src/leave-service/Program.cs
ContextOne LeaveDbContext with a Leave-owned default schemamicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
Repository/UoWTracked repositories and SaveChanges boundarymicroservices/src/leave-service/Infrastructure/Persistence.cs
Tenant modelEleven global filters; privileged-or-current-tenant predicatemicroservices/src/leave-service/Infrastructure/LeaveDbContext.cs
MigrationsThree source-controlled migrations and current snapshotmicroservices/src/leave-service/Infrastructure/Migrations/LeaveDbContextModelSnapshot.cs
FoundationCarry-forward and encashment are persisted but lack end-to-end orchestrationmicroservices/src/leave-service/Domain/Leave/LeaveExtras.cs

Compatibility persistence remains separate from the extracted context. Exact deployed names and connection configuration are intentionally excluded.

Source References

  • microservices/src/leave-service/Infrastructure/LeaveDbContext.cs
  • microservices/src/leave-service/Infrastructure/Persistence.cs
  • microservices/src/leave-service/Program.cs
  • microservices/src/leave-service/Domain/Leave/LeaveExtras.cs

See Also

Keywords

  • LeaveDbContext
  • EF Core
  • Persistence architecture

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly