Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…ence work) Component: Issue #242 [Foundation] - Implements core MenloDbContext infrastructure and DI registration - Establishes migration framework and schema management foundation - Adds TestContainers fixtures for persistence integration testing - Enables all downstream persistence features (audit, soft-delete, entity configs) This commit provides the essential infrastructure that enables the subsequent audit, soft-delete, and entity persistence features to integrate into the application.
…tStampFactory Component: Issue #242 [Audit Infrastructure - Part 1] Related: Issue #246 - Adds HttpContextAuditStampFactory for capturing current user context - Implements ReflectiveAuditStampFactory using reflection for DI resolution - Registers IAuditStampFactory in AddMenloApplication for AuditingInterceptor - Falls back to system actor when IHttpContextAccessor is unavailable This commit enables the AuditingInterceptor to transparently capture who made changes (created_by, updated_by) and when changes were made (created_at, updated_at) by providing a concrete implementation of the audit stamp factory.
Component: Issue #242 [User Persistence Context] - Adds IUserContext slice interface exposing DbSet<User> - Implements UserEntityTypeConfiguration with PostgreSQL mapping (shared.users table) - Maps User aggregate with UUID PK, audit stamps, and soft-delete support - Enables feature code to use IUserContext without direct MenloDbContext dependency This commit demonstrates the persistence pattern for bounded contexts by providing the first concrete slice interface. The User entity is persisted with full audit trail and soft-delete support as specified in Issue #242.
Component: Issue #242 [Soft-Delete Infrastructure] - Implements SoftDeleteInterceptor via EF Core SaveChangesInterceptor - Automatically captures soft-delete stamps (deleted_at, deleted_by) - Applies global query filter to exclude soft-deleted entities by default - Fully transparent; feature code never calls Delete() directly This commit completes the soft-delete infrastructure specified in Issue #242 by adding the interceptor and query filter that transparently handle deletions. Combined with the audit infrastructure, User entities now have full lifecycle tracking.
Supporting commit for Issue #242 persistence layer implementation. Formatting pass across all affected files to normalize code style and ensure consistency with project conventions.
9b0ffe0 to
24b26b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 252 - Persistence Layer Infrastructure (Issue #242 - Foundation Only)
Summary
This PR implements the core persistence infrastructure for Menlo, establishing the foundation for EF Core + PostgreSQL integration. It delivers the basic application layer framework (DbContext, DI, interceptors, and slice interfaces) and validates the approach with a complete User persistence example.
Status: Partially implements Issue #242. This PR establishes the persistence layer infrastructure and patterns; additional work is required to extend to all bounded contexts and complete documentation updates. See "What's Missing" section.
What's Implemented
✅ Persistence Infrastructure
✅ Domain Contracts (Menlo.Lib)
✅ User Persistence - Complete Example
✅ Integration Testing
✅ Deployment Integration
User Story Coverage
Implemented: 26 of 35 stories from Issue #242
What's NOT in This PR (Blocks Full #242 Closure)
Story 6: Money → numeric(18,4) Mapping ❌
Story 29: Documentation Updates ❌
Story 30: C4 Component Diagram ❌
Design Decisions
One DbContext: MenloDbContext implements all slice interfaces. Single scoped instance per request with shared change tracking.
Slice Interfaces as API: Feature code depends on IUserContext, never MenloDbContext. Enforces domain boundaries at type system level.
Real PostgreSQL Testing: All persistence tests use Testcontainers with actual PostgreSQL. No in-memory EF Core.
Fail-Fast Migrations: MigrateDatabaseAsync() on startup. Bad schema changes never deploy silently.
Commits
Testing
Follow-Up Work Required
Related: #242, #246, #251
Partially implements: #242