Entity auditor question

Posts   
 
    
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 22-May-2008 12:25:31   

I'm trying to create an auditor to keep the changes of field value, by comparing field DbValue and CurrentValue. If they are different, I tread it as changed and store both value into auditor trail log.

I work fine for new inserted entity, I can trace all the fields that user edited only and store them into the log. However, my design does not work for entity updating, I found that AuditorBase.AuditUpdateOfExistingEntity() is executed after SaveEntity(), and entity is refetched after saving, all the DbValue and CurrentValue are the same.

How can I get the entity before save in AuditorBase.AuditUpdateOfExistingEntity()?

Thank you!!!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-May-2008 12:40:57   

You might use the AuditEntityFieldSet to record field changes, this can be stored in your auditor object, then use the AuditUpdateOfExistingEntity to create the AuditInfoEntity based on the stored changes and then add it/them to the _auditInfoEntities.