Repository navigation
Add opt-in EF Core entity improvements at framework level - #27
Merged
Merged
Conversation
Introduce layered entity interfaces and convenience base classes in SimpleModule.Core that modules can adopt for automatic field population. Interfaces (SimpleModule.Core/Entities/): - IHasCreationTime, IHasModificationTime — auto-set timestamps - IAuditable — timestamps + CreatedBy/UpdatedBy from current user - ISoftDelete — intercepts hard delete, converts to soft delete - IVersioned — auto-incrementing version number - IHasConcurrencyStamp — random concurrency stamp - IHasExtraProperties — JSON key-value bag - IMultiTenant — auto-set tenant ID from ITenantContext + query filter - IHasDomainEvents — domain event collection + auto-dispatch Base classes (SimpleModule.Core/Entities/): - Entity<TId> — timestamps + concurrency - AuditableEntity<TId> — + CreatedBy/UpdatedBy - FullAuditableEntity<TId> — + soft delete + versioning - MultiTenantFullAuditableEntity<TId> — + tenant + extra properties - AuditableAggregateRoot<TId> — + domain events Interceptors (SimpleModule.Database/Interceptors/): - EntityInterceptor — populates fields based on interfaces - DomainEventInterceptor — dispatches domain events after save - EntityChangeInterceptor — invokes IEntityChangeHandler<T> after save Conventions auto-applied via ApplyModuleSchema(): - ISoftDelete → global query filter (named) - IMultiTenant → parameterized query filter via ApplyMultiTenantFilters() - IHasConcurrencyStamp/IVersioned → concurrency tokens - IHasExtraProperties → provider-aware JSON column Uses EF Core 10 named query filters so soft-delete and multi-tenant filters coexist independently. EntityChangeInterceptor uses compiled expression-tree delegates for zero-reflection dispatch at runtime. AuditSaveChangesInterceptor updated to detect soft-delete changes.
antosubash
force-pushed
the
claude/efcore-entity-improvements-X8z2C
branch
from
March 29, 2026 19:42
bc19983 to
72b929f
Compare
Deploying simplemodule-website with
|
| Latest commit: |
72b929f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://759b46c8.simplemodule-website.pages.dev |
| Branch Preview URL: | https://claude-efcore-entity-improve.simplemodule-website.pages.dev |
antosubash
pushed a commit
that referenced
this pull request
Mar 29, 2026
Migrate FeatureFlagEntity and FeatureFlagOverrideEntity to inherit from Entity<int>, gaining automatic CreatedAt/UpdatedAt population via the EntityInterceptor, and ConcurrencyStamp for optimistic concurrency. Remove manual UpdatedAt assignments since the interceptor handles them. https://claude.ai/code/session_01Cfi9aG39WHwLr2cmsmPAnK
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.
Introduce layered entity interfaces and convenience base classes in
SimpleModule.Core that modules can adopt for automatic field population:
Interfaces (SimpleModule.Core/Entities/):
Base classes (SimpleModule.Core/Entities/):
Interceptors (SimpleModule.Database/Interceptors/):
Conventions auto-applied via ApplyModuleSchema():
Also updates AuditSaveChangesInterceptor to detect soft-delete changes
and log them as Deleted instead of Updated.