Expense Database Overview
Summary
The runtime ExpenseDbContext owns the production persistence model and outbox conversion. ExpenseDbContextFactory creates it for design-time migration tooling. ExpenseBackfillDbContext derives from it for transition tooling and changes only compatibility-identifier generation.
Audience
Backend developers, database reviewers, QA, architects, DevOps, support, and implementation teams.
Confirmed persistence
| Context or factory | Scope | Confirmed distinction |
|---|---|---|
| ExpenseDbContext | Production runtime | Owns every Expense EF mapping, tenant filters, and outbox conversion during SaveChanges |
| ExpenseDbContextFactory | Design time | Creates ExpenseDbContext with a non-request privileged tenant context for migration tooling |
| ExpenseBackfillDbContext | Transition tooling | Derives from ExpenseDbContext and disables store generation for CompatId; it is not a second production store |
No additional production runtime, read-only, reporting, or legacy-source DbContext is confirmed. The monolith source reader and derived backfill target context are transition tools, not another production system of record.
Requires confirmation
Production migration governance, retention, archival, masking, performance targets, concurrency roadmap, operational-store access, and rollback ownership remain unconfirmed unless narrowed above.
Source References
microservices/src/expense-service/Infrastructure/ExpenseDbContext.csmicroservices/src/expense-service/Infrastructure/Persistence.csmicroservices/src/expense-service/Backfill/ExpenseBackfillTypes.cs
Related Articles
See Also
Keywords
- Expense database
- Database Overview
Revision Information
- Status: Draft
- Last reviewed: 2026-07-16
- Review cycle: Quarterly