You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,7 +38,8 @@ UMS serves as an authorization and identity gateway that can either function as
38
38
```
39
39
40
40
### Shared Architectural Principles
41
-
1.**Domain Purity**: The Domain layer (`{BoundedContext}.Domain`) consists of pure C# objects (POCOs) with zero external library references, ensuring business logic remains unpolluted.
41
+
42
+
1.**Domain Purity**: The Domain layer (`{BoundedContext}.Domain`) contains the pure DDD model — Aggregate Roots, Entities, Value Objects, Domain Events, invariants, and domain services — with zero external framework references.
42
43
2.**Explicit Boundaries**: Cross-context interactions are strictly decoupled using event-driven communication (Transactional Outbox) or explicit Application-layer Anti-Corruption Layers (ACLs). Direct cross-context database joins are strictly prohibited.
43
44
3.**Tenant Isolation**: High-security multi-tenancy is enforced natively in the Application layer, with SQL Server Row-Level Security (RLS) serving as an infrastructure-level secondary failsafe (R-10).
44
45
4.**Command-Query Responsibility Segregation (CQRS)**: Read models are highly optimized and separated from write models. Writes are strictly transaction-safe, while reads leverage efficient flat projections or direct GraphQL execution.
@@ -78,17 +79,19 @@ graph TD
78
79
79
80
## 3. High-Level Bounded Context Map
80
81
81
-
UMS is partitioned into **nine Bounded Contexts** (seven with owned entities, plus Cache and Console support contexts). Two contexts — Approvals and Compliance — are unified under `Ums.Domain.Approvals` in the codebase for implementation simplicity:
82
+
UMS is partitioned into **nine logical Bounded Contexts**. Seven own domain entities directly; Cache and Console are support contexts. The Compliance logical context is implemented under the Approvals namespace for implementation simplicity, but remains conceptually distinct for business language and governance.
82
83
83
-
1.**Identity BC** (`ums_identity`): Governs tenant registration, organizational branches, white-label branding, identity providers, and user account lifecycles.
All domain rules, invariants, and architectural diagrams are consolidated within each Aggregate Root's dedicated documentation file. Owned child entities are documented within their parent AR's page — they do not have separate top-level entries.
146
+
The authoritative aggregate-root inventory is maintained in the [Domain Aggregate Index](../domain/index.md). This overview intentionally summarizes rather than duplicating all entity detail.
140
147
141
-
See [Domain Aggregate Index](../domain/index.md) for the full inventory.
> **Counting rule:** The Domain Aggregate Index is the source of truth for aggregate count and ownership. Architecture summaries must not define independent aggregate totals.
160
158
161
159
---
162
160
@@ -165,22 +163,40 @@ See [Domain Aggregate Index](../domain/index.md) for the full inventory.
165
163
To preserve DDD bounded context purity while maintaining system cohesion, the following integration standards must be strictly followed:
166
164
167
165
### 1. The Transactional Outbox Pattern
166
+
168
167
Every state-changing operation within an aggregate must publish events to a local outbox table **in the same database transaction**. An asynchronous dispatcher reads these entries and forwards them to Dapr PubSub for cross-context delivery. This ensures reliable eventual consistency without distributed 2PC transactions.
169
168
170
169
### 2. Integration via Core Identifiers
170
+
171
171
Aggregates in downstream contexts must NEVER reference entities of upstream contexts directly. Instead, they reference only their global identifier (`TenantId`, `UserId`, `BranchId`, etc.) stored as strong Value Objects.
172
172
173
173
### 3. Anti-Corruption Layers (ACL)
174
-
When a context integrates with external directories or Legacy HR Systems, an explicit Anti-Corruption Layer (consisting of Adapters, Translators, and Facades) is built inside the infrastructure layer to prevent external concepts from bleeding into the pure Domain model.
174
+
175
+
When a context integrates with external directories or legacy HR systems, an explicit Anti-Corruption Layer (consisting of Adapters, Translators, and Facades) is built inside the infrastructure layer to prevent external concepts from bleeding into the pure Domain model.
176
+
177
+
---
178
+
179
+
## 6. Data Model Governance
180
+
181
+
UMS has three complementary data-model views:
182
+
183
+
| View | Source | Purpose |
184
+
|---|---|---|
185
+
| Conceptual |[Conceptual Data Model](../governance/requirements/conceptual-data-model.md)| Business-readable language and early requirements validation. |
| Physical |[Database Design ER](./blueprints/database-design-er.md)| Authoritative SQL Server / EF Core-aligned physical entity-relationship model. |
188
+
189
+
Use [Data Model Consistency Review](./blueprints/data-model-consistency-review.md) when validating alignment across conceptual names, DDD aggregates, ER diagrams, and EF Core persistence records.
175
190
176
191
---
177
192
178
-
## 6. Shared Architectural Rules
193
+
## 7. Shared Architectural Rules
179
194
180
-
-**Zero NuGet References in Domain**: The Domain project is 100% pure C#.
195
+
-**Zero Framework References in Domain**: The Domain project is pure C# and must not reference EF Core, ASP.NET, HotChocolate, Dapr, or infrastructure libraries.
196
+
-**DDD-first Language**: Architecture documents should use Aggregate Root, Entity, Value Object, Domain Event, Invariant, and Bounded Context as the dominant vocabulary. Technical .NET terms may be used only when clarifying implementation constraints.
181
197
-**Result Pattern**: Application flows do not throw control exceptions. All business validations return a `Result<T>` structure mapping out failure cases clearly.
182
-
-**Single Source of Truth**: Business invariants and entity schemas belong strictly in their respective aggregate files listed in Section 4. Do not copy ER schemas or diagrams into any other architectural indexes.
198
+
-**Single Source of Truth**: Business invariants and domain entity schemas belong in their respective aggregate files listed in the Domain Aggregate Index. Physical schema belongs in the Database Design ER.
183
199
184
200
---
185
201
186
-
**[Back to Master Index](../MASTER_INDEX.md)** | **[Go to Domain Index](../domain/index.md)**
202
+
**[Back to Master Index](../MASTER_INDEX.md)** | **[Go to Domain Index](../domain/index.md)**
0 commit comments