Adopts Evolith: Evolith ADR-0067 — Modular Monolith Persistence Boundaries (Schema-Per-Domain). UMS retains this document as its SQL Server schema-per-module implementation record.
Status: Accepted
Date: 2026-05-27
Decision Owner: Architecture
Parent: ADR-0067 — Modular Monolith Schema Per Domain
UMS is a modular monolith built on .NET 10 and SQL Server, implementing multiple bounded contexts (Identity, Authorization, Configuration, Audit, Approvals, IGA). The Evolith architecture baseline (ADR-0067) mandates that each bounded context must own its own database schema within a single physical database, enforcing logical separation and module ownership.
Prior to this decision, schema naming was inconsistent between documentation and code, and some entity configurations relied on the DbContext default schema fallback rather than explicitly declaring their schema. This created risks of:
UMS uses a single physical SQL Server database with dedicated schemas per bounded context. Each module owns its schema and its tables. Cross-module database access is prohibited at the repository level.
| Bounded Context | Code | Schema Name | Owner Module |
|---|---|---|---|
| Identity | BC-A | ums_identity |
Ums.Infrastructure/Persistence/Identity/ |
| Authorization | BC-B | ums_authorization |
Ums.Infrastructure/Persistence/Authorization/ |
| Configuration | BC-C | ums_configuration |
Ums.Infrastructure/Persistence/Configuration/ |
| Audit | BC-D | audit |
Ums.Infrastructure/Persistence/Audit/ |
| Approvals | BC-F | approvals |
Ums.Infrastructure/Persistence/Approvals/ |
| IGA | BC-H | iga |
Ums.Infrastructure/Persistence/IGA/ |
| Platform/Outbox | Infra | ums_platform |
Ums.Infrastructure/Persistence/Outbox/ |
IEntityTypeConfiguration must call ToTable(tableName, schema) with the module’s schema constant. No entity may rely on HasDefaultSchema() fallback.*PersistenceConstants.cs file under its persistence folder.dbo usage. No table may be created in the default dbo schema.UmsPlatformDbContext serves all bounded contexts but respects schema boundaries through explicit ToTable(tableName, schema) in each entity configuration:
// Example: Authorization entity configuration
builder.ToTable("SystemSuites", AuthorizationPersistenceConstants.Schema);
The default schema (ums_platform) is set as a fallback for infrastructure entities only (Outbox), but even these must explicitly declare their schema.
UmsPlatformDbContext, creating compile-time coupling. This is accepted for a modular monolith but would need refactoring if UMS evolves to a distributed architecture.ums_ prefix (audit, approvals, iga). This is a pragmatic choice to keep names concise; the ums_ prefix is reserved for core business contexts.ToTable(tableName, schema) with a constant from *PersistenceConstants.cs.CREATE SCHEMA) and all tables within that schema.| ADR Index | Parent ADR-0067 |