Open Closed

Entity change auditing #6211


0
digitalcontrol created

I have an issue with AbpEntityPropertyChanges table. Records are being added when new entity is created but not when it is updated. AbpEntityChanges works perfectly fine. Do you have any hint regading that?


4 Answer(s)
  • 0
    aaron created
    • What is your ABP version?
    • What is your ASP.NET Zero version?
    • Can you show code used for updating?
  • 0
    digitalcontrol created

    Hi, sorry because late response, we were on New Year holiday. That was a good hint, we had a problem with updating and we solve it. Right now we are struggling with showing changes just for the particular entity, or more precisely , we want to filter by ID of the entity in order to show changes just for the particular record. Do you have any hint for this issue, should we use custom data as it described in the article below or there is a more simple way to achieve that? https://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=4152&p=9553&hilit=customdata+abpauditlogs#p9553

    Thank you in advance!

  • 0
    digitalcontrol created

    Dear Aaron, just to check did you see my message above, thank you.

  • 0
    aaron created

    You should filter EntityChange by ec.EntityId == entity.Id, and include its ec.PropertyChanges collection.

    var entityChanges = _entityChangeRepository
        .GetAllIncluding(ec => ec.PropertyChanges)
        .Where(ec => ec.EntityId == entity.Id)
        .ToList();
    

    P.S. I did see your message before, but didn't understand how it related to the original question. Please create a new question in future.