Auditing and lookup tables

Posts   
 
    
danh
User
Posts: 70
Joined: 16-Jul-2007
# Posted on: 29-May-2008 17:38:04   

Hi,

I am trying to add auditing support to my application but have run up against a problem that someone else may have experienced.

I have a table named Property, which contains a PropertyStatusID field that references a lookup table, PropertyStatus (ID, Name). So each property can be associated with a status by its ID.

When a PropertyEntity is saved, I am using an Auditor to record any changes to its fields to a separate table. So far so good. But when a property's status changes, I record that its PropertyStatusID field has changed (for example, from 2 to 4). This isn't very descriptive for users - I would like to be able to record the name from the lookup table - to say, for example, that the status has changed from "Pending" to "Live". I cannot find a way to get at this information from within the Auditor, as it would require making a database call to fetch the lookup value, and the Auditor has no DataAccessAdapter to use. The related lookup entity is not fetched from the database with the Property entity, as the client keeps its own cached list of lookup values. The entity is being saved in a WCF service.

Does anyone have any ideas how to accomplish this or even if it can be done? I am using Adapter templates, LLBLGen v2.5, .NET 3.5.

Thanks in advance, Dan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-May-2008 05:08:17   

Hi Dan, first of all, What is the target of the Auditing (TextFile, Database..)?

My suggestions are:

A. If you are auditing to the database, Shouldn't be better to link the referenced row at the audit table (PropertyAuditInfo.PropertyStatusId).

B. Any chance you could attach the related PropertyStatusEntity to the PropertyEntity and send it?

C. You could store somewhere at server-side an static collection of PropertyStatus entities and memory-filter it when you audit.

David Elizondo | LLBLGen Support Team