Skip to content

DbContext Interceptor Change#79

Merged
JJBussert merged 2 commits into
e13tech:mainfrom
JJBussert:main
Apr 21, 2025
Merged

DbContext Interceptor Change#79
JJBussert merged 2 commits into
e13tech:mainfrom
JJBussert:main

Conversation

@JJBussert
Copy link
Copy Markdown
Contributor

No description provided.

@JJBussert JJBussert requested a review from Copilot April 21, 2025 20:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates how audit properties are handled in the DbContext by replacing custom SaveChanges overloads with interceptor-based behavior and updating tests to register these interceptors. Key changes include:

  • Removing default initialization values for created audit fields in test entities
  • Updating test setups for DbContext to register Creatable, Modifiable, and SoftDelete interceptors
  • Refactoring BaseDbContext to implement IAuditContext and removing legacy tagging methods

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/E13.Common.Data.Db.Tests/Sample/TestCreatable.cs Removed default audit values for CreatedBy and CreatedSource
test/E13.Common.Data.Db.Tests/BaseDbContext_IModifiableTests.cs Updated DI setup to register interceptors and removed SaveChanges overloads with parameters
test/E13.Common.Data.Db.Tests/BaseDbContext_IDeletableTests.cs Updated DI setup to register interceptors and removed SaveChanges overloads with parameters
test/E13.Common.Data.Db.Tests/BaseDbContext_ICreatableTests.cs Modified DI registration to use scoped interceptors for audit properties
src/E13.Common.Data.Db/Interceptors/SoftDeleteInterceptor.cs Added interceptor to handle soft-delete logic
src/E13.Common.Data.Db/Interceptors/ModifiableInterceptor.cs Added interceptor to update modification audit information
src/E13.Common.Data.Db/Interceptors/CreatableInterceptor.cs Added interceptor to update creation audit information
src/E13.Common.Data.Db/IAuditContext.cs Introduced the IAuditContext interface for audit metadata handling
src/E13.Common.Data.Db/BaseDbContext.cs Refactored SaveChanges override to set audit properties and removed legacy tagging logic
Comments suppressed due to low confidence (1)

src/E13.Common.Data.Db/BaseDbContext.cs:75

  • Ensure that retaining a previously set AuditUser (instead of overriding it with the current caller's information) is the intended behavior; if the audit should reflect the current user, consider updating AuditUser accordingly.
AuditUser = AuditUser ?? UnknownUser;

@JJBussert JJBussert merged commit 3cd48df into e13tech:main Apr 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants