Support auditing and history for complex properties#24767
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds support for EF Core Complex Properties in ABP's auditing and entity history tracking. Previously, complex properties were not included in change detection, causing entity history records to be missing and modification audit properties (like ModifierId) not to be set when only complex property values changed.
Changes:
- Extended
AbpDbContextto include complex property entries when checking for modifications - Added complex property tracking to
EntityHistoryHelperfor property change history - Added test entities with complex properties and comprehensive test coverage for auditing behavior
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs |
Added GetAllPropertyEntries method to combine regular and complex properties; updated modification tracking to use this method |
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs |
Added iteration through complex properties for entity history; changed method signature to accept IReadOnlyPropertyBase for broader compatibility |
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Person.cs |
Added PersonContactInformation complex property with various DisableAuditing attributes for testing |
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs |
Initialized test data with complex property values |
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/TestAppDbContext.cs |
Configured complex property mapping for Person.ContactInformation |
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/TestMigrationsDbContext.cs |
Configured complex property mapping for migrations context |
framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Auditing/Auditing_Tests.cs |
Added comprehensive tests for complex property auditing behavior with DisableAuditing attributes |
framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs |
Added test for entity history tracking of complex property changes |
framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithComplexProperty.cs |
Created test entity with complex property for auditing tests |
framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/EntityFrameworkCore/AbpAuditingTestDbContext.cs |
Configured complex property mapping for auditing tests |
framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestModule.cs |
Registered complex property entity for entity history tracking |
...lo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs
Show resolved
Hide resolved
...lo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs
Show resolved
Hide resolved
...lo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs
Outdated
Show resolved
Hide resolved
…complex property changes and updating related tests
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
Outdated
Show resolved
Hide resolved
...lo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs
Show resolved
Hide resolved
.../test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithComplexProperty.cs
Show resolved
Hide resolved
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
Show resolved
Hide resolved
salihozkara
approved these changes
Jan 29, 2026
EngincanV
approved these changes
Jan 29, 2026
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.
Resolve #24764