Good morning,
We have a problem with the ABP audit.
The situation is as follows:
We have entity A (aggregate) which, if we modify related properties (foreign key), is not being updated in the LastModificationTime column of entity A.
It should show today's date, 2025-11-05.

Therefore, AbpEntityChanges is not recorded with the correct date.
We have overwritten your code and noticed that you have this if statement. Is there a specific reason for this?
3 Answer(s)
-
0
- Solution
What you observe is by design in ABP Framework versions before 8.3. In AbpDbContext.PublishEventsForTrackedEntity, ABP intentionally skips “updated” entity events and ABP concept application when only foreign key properties are modified:
- If all modified properties are metadata.IsForeignKey(), it breaks without calling ApplyAbpConceptsForModifiedEntity and without publishing EntityUpdated events. Consequently:
- LastModificationTime/LastModifierId aren’t updated.
- EntityUpdated event and AbpEntityChanges may not reflect the parent aggregate update timestamp as you expect.
- If all modified properties are metadata.IsForeignKey(), it breaks without calling ApplyAbpConceptsForModifiedEntity and without publishing EntityUpdated events. Consequently:
Reason: This optimization existed to avoid firing update logic when only relationship fixups (FK changes) happen and the entity’s own scalar properties didn’t change.
Starting from ABP 8.3, this behavior was changed: ABP applies auditing/concurrency updates when a navigation property changes. That means LastModificationTime, LastModifierId, ConcurrencyStamp and EntityVersion are updated when navigation (and thus FK) changes are detected.
Your project is on ABP 9.1.3, which already includes that change. To ensure it’s active:
- Make sure you’re using the EF Core integration (Volo.Abp.EntityFrameworkCore) that contains the updated AbpDbContext. The AbpDbContext implementation on the dev branch (and since 8.3) applies ABP concepts when navigation changes occur.
- Ensure the option that controls publishing for navigation changes is not disabled. ABP provides an option on the local event bus side:
- AbpEntityChangeOptions.PublishEntityUpdatedEventWhenNavigationChanges should be true (default). If you had set it to false anywhere, EntityUpdatedEvent will not be published when navigation changes, which can also affect auditing/event emission behavior. Example:
Configure<AbpEntityChangeOptions>(o => { o.PublishEntityUpdatedEventWhenNavigationChanges = true; // default });- Verify that your FK change is tracked as a navigation change within the same DbContext unit of work. If you’re using a read-only/no-tracking repository or manually turned off tracking, EF Core won’t report the modification and ABP can’t apply modification audit properties.
- Use IRepository (tracking) for updates; avoid IReadOnlyRepository or NoTracking queries when you intend to modify.
- Do not override AbpDbContext.PublishEventsForTrackedEntity to restore the old “skip FK-only” branch. If you have customized AbpDbContext and re-introduced the condition you highlighted (skipping when all modified properties are foreign keys), remove that branch so ABP can apply modification audit properties and publish the update.
- Make sure entity change auditing is enabled if you rely on AbpEntityChanges rows:
Configure<AbpAuditingOptions>(options => { options.EntityHistorySelectors.AddAllEntities(); });Note: Even without entity history, the LastModificationTime should be set by ApplyAbpConcepts once navigation/FK changes are considered updates.If you must keep older behavior (pre-8.3) or selectively control it:
- You can re-add the FK-only skip in a derived DbContext (not recommended), or set PublishEntityUpdatedEventWhenNavigationChanges = false to stop EntityUpdated events for navigation changes. This will again stop LastModificationTime updates tied to those events. The recommended path is to keep the default behavior introduced in 8.3.
Summary action items for your case:
- Remove/undo the “skip if all modified are foreign keys” code in your overridden DbContext.
- Ensure PublishEntityUpdatedEventWhenNavigationChanges is true (default).
- Ensure tracking is enabled for the update UoW.
- With ABP 9.1.3, FK-only changes should update LastModificationTime and be captured in audit changes as per the new behavior.
- Sources
- https://abp.io/docs/latest/framework/infrastructure/audit-logging
- https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
- https://abp.io/docs/latest/release-info/migration-guides/abp-8-3
- https://abp.io/docs/latest/framework/infrastructure/event-bus/local/
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
This is the code of the 9.1.3 version This is the url of your code: https://github.com/abpframework/abp/blob/9.1.3/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
-
0
hi
We enhanced it in the next 9.3.x version
You can override the method to change it now.
See
https://abp.io/support/questions/10057/LastModification-fields-not-updated-when-changing-one-to-many-relationship#answer-3a1d5bfa-d803-667e-e95a-7f8900a6abc8 https://github.com/abpframework/abp/pull/24104
Thanks

