Recommendation on Supress Audit Field Set Event

Posts   
 
    
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 04-Jun-2008 17:25:53   

I am using the llblgen 2.5 auditing framework to track field changes. In one scenario I have a customer who's last name has changed from SMITH to JOHNSON via asp.net webform. The field was set, the isChanged flag is true, and an audit event is added to the audits collection using AuditEntityFieldSet.

Before saving the entity, I verify that the lastname is all uppercase by calling the method ToUpper(). This doesn't change the lastname since user already input it as all uppercase. The problem is that setting to uppercase, even though has no change on the lastname value, triggers another audit event. In my audit collection, I now get the following fieldSet events:


+-------------------------------------------+
| field      | oldValue | newValue |
+-------------------------------------------+
| lastName | SMITH     | JOHNSON  |
+-------------------------------------------+
| lastName | JOHNSON  | JOHNSON  |
+-------------------------------------------+

As you can see, the 2nd audit event should not be recorded since the value did not change. However, in the AuditEntityFieldSet event, I can't compare oldValue to newValue since in that context, the oldValue is not what the field was changed to before being changed to uppercase, but rather dbValue.

Is there a way to suppress a fieldSet audit for the above situation? I guess I could enumerate the audits collection to see if a change with the same fieldname has already been recorded, but it seems inefficient and I was wondering if there is a better approach.

Thanks!

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 05-Jun-2008 06:15:51   

I think its just been fixed (setting an identical value is a no-op): http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13493&StartAtMessage=0&#75126

Cheers Simon

luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 05-Jun-2008 16:59:21   

Thanks!!!