Automatic update of a changedata field

Posts   
 
    
JayBee
User
Posts: 282
Joined: 28-Dec-2006
# Posted on: 17-Jul-2008 22:37:09   

Hi,

I'm using LLBLGenPro 2.6, Self Servicing, SQLServer 2005.

I have a simple parameter-table e.g.

ID NAME VALUE CHANGEDATE

I created a simple webform holding a grid which allows the user to only change the value. Just like the example in the documentation (see Generated code - Databinding with ASP.NET 2.0, SelfServicing), without any extra coding. When the VALUE has changed, the gridview / LLBLGenDataSource automatically update it in the database.

I would like to know the easiest way to update the changedate when an entity is updated.

When should I use the Auditing features? I.e. seperate auditing table(s) and use dependency injection? Doesn't that make queries such as give me all entities in decending changedate order difficult?

Thanks,

Jan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Jul-2008 05:16:00   

Hi Jan,

If you want to separate the auditing logic from your GUI and/or business process, then I would recommend using Adutiors. You can audit in the same table you are updating (i.e.: only update the CHANGEDATE field when Value is modified).

Dependency Injection is just a facility to set the Auditors objects, is useful if you want plug, unplug or plug different versions of an auditor. Though in this case I would just write an Auditor, or create a partial class that override the OnAuditEntityFieldSet method.

David Elizondo | LLBLGen Support Team