Retaining a changed child entity on save

Posts   
 
    
jackscoldsweat avatar
Posts: 16
Joined: 11-Oct-2004
# Posted on: 22-Dec-2004 21:07:30   

Hello there

Wondering if you can help me with something. We have 2 related entities. A Person and a Contact where the Contact contains (amongst other things) a phone number for the Person

By storing the PersonID against the contact AND the ContactID against a Person in the database the LLBL very nicely allows me to either return a collection of Contacts (phone numbers) for the Person or the one "Preferred" phone number for that Person

We have a number of scenarios throughout our system like this one.

What we have also done is to set up an Audit Entity that will log all changes to our Entities as users make changes within the system. When the user makes changes I interrogate the DBValue of the changed field in the Fields collection for the Entity so that I can write a meaningful English statement in the Audit Log (e.g. "Changed Phone Number from (DBValue) to (CurrentValue)")

What I would like to know is: Does the "Preferred" Contact Entity itself linger in memory in a similar manner to the DBValue field in the Fields collection because I don't want to have to retrieve the old preferred Contact from the database, everytime the user clicks save, to record a meaningful description in the Audit trail...

If so how can I reference it?

Any ideas?

regards

Randall

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Dec-2004 09:12:52   

No, once the reference is set to another entity, the old reference is not preserved. However, the DbValue for the FK fields which actually signal which related entity is related can help you retrieve the 'original' value. It's not that easy to write generic logging code for this I'm afraid.

Frans Bouma | Lead developer LLBLGen Pro
jackscoldsweat avatar
Posts: 16
Joined: 11-Oct-2004
# Posted on: 24-Dec-2004 03:25:59   

Otis wrote:

It's not that easy to write generic logging code for this I'm afraid.

No worries - we figured it was a long shot... and we can work around it - thanks for the prompt reply

Have a safe and merry Christmas and New Year and many thanks for a great product and the top-shelf support this year

regards

Randall

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-Dec-2004 10:41:24   

simple_smile You also have great holidays! simple_smile

Frans Bouma | Lead developer LLBLGen Pro