Base solution for your next web application
Open Closed

Change history for Root Aggregates #8987


User avatar
0
jtallon created

HI there,

Can you please outline how we might turn on Change history Logging for a root entity and its child collections ?

For example, if I have a root entity named Order, and that Order Entity has a child collection of OrderItems, can you offer a suugestion has to how we might track changes to both the OrderItems and Order is the same change log?

This is urgent for us, so would really appreciate some pointers on how to achieve this in ZERO.

Regards John


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @jtallon,

    You can add your entities to https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/EntityHistory/EntityHistoryHelper.cs.

    Does your app change Order and OrderItem together ? If you are doing it like that, both change records must be grouped under same EntityChangeSets. You can see it in AbpEntityChangeSets table in the database.

  • User Avatar
    0
    jtallon created

    Hi @ismcagdas,

    The user might make a change to an OrderItem or the OrderDetails (Parent) or both. We want to allow the user to view the history on the OrderDetails where they will be able to see if a OrderItem has also been changed.

    In summayr, we want to track any change to an entity and any related enities by looking at the root... OrderDetails.

    Hope this is achieveable?

    Regards John

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @jtallon

    This is not possible by defualt. However, if you keep a list of entities and their relations in somewhere (maybe it is possible to find relations using code but I couldn't find any way at the moment), and filter AbpEntityChanges with it's EntityTypeFullName field by main Entity and related entities.