Open Closed

Audit columns for parent table is not updating when child table is updated using parent and child data in same object #9642


User avatar
0
priyankasynapxe created

ABP Framework version: v8.1.1

UI Type: React

Database System: EF Core (SQL Server)

Tiered (for MVC) or Auth Server Separated (for Angular): yes

Exception message and full stack trace: NA

Hi, I have updated ABP's version few months back and I noticed after version update, if user is updating data for any child table then Audit columns like last modifier id and last modification time is not updating, earlier it used to update automatically, we display last modification time of parent's table to user, so if any data is updated from same page which contains only child class change, it is not changing last modification time, please help to find the root cause and fix.

Thanks


4 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    Starting from ABP Framework v8.3, there was a change in how audit properties (such as LastModifierId and LastModificationTime) are updated when navigation (child) properties change. In previous versions, updating a child entity through a parent would automatically update the parent's audit columns. However, after the update, this behavior was modified to only update the parent's audit columns if the navigation property itself changes, not just the child entity's data.

    This means that if you update only the child entity (e.g., a collection or owned entity) and not the parent entity or its navigation property reference, the parent's audit columns will not be updated automatically.

    To restore the previous behavior, you need to explicitly update the parent entity or set a property on the parent to trigger the audit property update when a child entity changes.

    Example workaround:

    // After updating the child entity
    parentEntity.LastModificationTime = DateTime.Now; // or any other property change
    await _parentRepository.UpdateAsync(parentEntity);
    

    Alternatively, you can review your domain logic to ensure that any child entity update also marks the parent as modified if you want the audit columns to reflect changes in child entities.

    Sources:

    • https://abp.io/docs/latest/release-info/migration-guides/abp-8-3
    • https://abp.io/support/questions/7462

    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.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How can I reproduce this?

    Can you share some code and steps

    Thanks.

  • User Avatar
    0
    priyankasynapxe created

    [maliming] said: hi

    How can I reproduce this?

    Can you share some code and steps

    Thanks.

    yes, to reproduce refer the below example, here my teams table is child table and its parent is user table, in first example I just updated isActive value from false to true and with that Modifier id and modification time was update but in second example I updated teams so Modifier id and modification time is not updated for user table, it is updated for user and team mapping table, audit information for parent table used to update earlier but it stopped updating after abp version update

    { "userId": "03a062cb-49b9-4b1e-94b9-69bfdb381a8f", "fullName": "test", "email": "testuser@test.sg", "isActive": true, "institutionId": 5, "remark": null, "roleId": "1d761946-076c-dfaa-832f-3a09ec002f59", "teams": [ 23 ] }

    { "userId": "03a062cb-49b9-4b1e-94b9-69bfdb381a8f", "fullName": "test", "email": "testuser@test.sg", "isActive": true, "institutionId": 5, "remark": null, "roleId": "1d761946-076c-dfaa-832f-3a09ec002f59", "teams": [ 23, 25 ] }

    let me know if you need more details.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Thanks, can you share a simple project?

    liming.ma@volosoft.com

    Thanks.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 08, 2025, 09:55