BeforeSave Auditing

Posts   
 
    
mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 21-Apr-2009 02:31:21   

Is it possible to get access to the entity prior to save? I would like to write an auditor that writes some auditing data with the complete list of values changed pior (or after) saving.

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Apr-2009 04:45:27   

Yes, it is. I recommend you to download the Auditing example at example's section to understand how to do that.

David Elizondo | LLBLGen Support Team
mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 21-Apr-2009 05:27:35   

daelmo wrote:

Yes, it is. I recommend you to download the Auditing example at example's section to understand how to do that.

Thanks, I understand I can get the changes to each field; but is there a way to detect ALL change to the entity prior to saving (or after) wards?

I like to write one auditing record containing all the details of the changed fields?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Apr-2009 05:35:36   

I like to write one auditing record containing all the details of the changed fields?

No, you have to detect the changes per field on the corresponding event, then before save you can get those together and write your auditor record. Please review the example to see what I mean simple_smile . I think there is no other way as if you use the OnUpdateExistingEntity event, the event is called right after the entity was saved, so there is no posibility to detect the old value.

David Elizondo | LLBLGen Support Team