Auditor - AuditUpdateOfExistingEntity

Posts   
 
    
przemor
User
Posts: 1
Joined: 09-Jan-2013
# Posted on: 09-Jan-2013 20:20:41   

Hi, Why in AuditUpdateOfExistingEntity method property of entity IsDirty is false and property entity's fields IsChanged is false too.

I would like to save only the final changes in entity's fields.

Regards Przemo

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Jan-2013 05:45:50   

Hi Przemo,

AuditUpdateOfExistingEntity is called after the successful entity update and before the commit, so the save already took place, that's why you can't rely on entity.IsDirty or entity.Fields[].IsChanged.

If the runtime is already inside AuditUpdateOfExistingEntity you can assume that the entity was dirty and that's is why you are auditing it. For the fields, you should audit them at AuditEntityFieldSet method and save them in a list of changes so you can use that list at AuditUpdateOfExistingEntity to save the full list of changes. This is illustrated in the Aduiting example you can download at http://llblgen.com/Pages/ListAdditionalDownloads.aspx#6

David Elizondo | LLBLGen Support Team