Converting existing auditing to LLBL?

Posts   
 
    
Jamison avatar
Jamison
User
Posts: 14
Joined: 22-Dec-2006
# Posted on: 06-Dec-2007 23:53:16   

I am trying to decide if I can make my existing audit strategy work with LLBL auditors. I am currently using my home rolled, self-servicing ORM, but I am moving to LLBL v2.5's adapter model.

This is my existing strategy: 1. My entities have a LastModified (datetime) and LastModifiedUserID (int) column 2. In BLL before a dirty entity is saved, I tag the last modified fields. 3. In the DB triggers save a copy into the audit tables database. ex. AuditDatabase.dbo.CustomerAudit which has the same columns as ProductionDatabase.dbo.Customer with the addition of AuditDate and AuditType.

I have setup a CustomerAuditor class, but it seems all the methods are called after the data operation. Is there anyway to set the LastModified fields before the save occurs with an auditor?

Thanks, Jamison

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 07-Dec-2007 17:13:24   

I have setup a CustomerAuditor class, but it seems all the methods are called after the data operation. Is there anyway to set the LastModified fields before the save occurs with an auditor?

I don't think it would make a big difference, but you may handle the AuditEntityFieldSet instead of AuditUpdateOfExistingEntity to set the LastModifiedDate.

As this action will be called on each Field set, and you might not want to add an AuditInfo record for each field set, you might just grab the needed AuditInfoEntity from the _auditInfoEntities and modify the LastModifiedDate.

Jamison avatar
Jamison
User
Posts: 14
Joined: 22-Dec-2006
# Posted on: 07-Dec-2007 19:57:58   

Thanks Walaa, I think that is what I needed. I'm not creating audit entities because saving the audit log to the audit database is handled by the trigger. I just needed a way to tag the row with who last modified it.

Jamison

PS. LLBL support is the best!