Dirty Columns?

Posts   
 
    
gj1118
User
Posts: 30
Joined: 21-Jul-2010
# Posted on: 06-Nov-2010 09:52:26   

Hi

I would like to know, for an entity, is there a way, I can know if there are any columns that the user has worked on, i.e if they are dirty..

what i am trying to say is this ..

suppose there is an entity abc.. Entity ABC has 3 columns.. a user comes in and modifies only column 1 of Entity ABC.. is there a way in LLBLGEN i can say , " the user changed column 1 "

I would like to implement this feature for my logging

Thanks and Regards Gagan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Nov-2010 23:03:56   

You can ask for entity.IsDirty or entity.Fields.IsDirty to know if something has been changed. Then you can loop through fields to know what is changed. Example:

if (myEntity.IsDirty)
{
     foreach (IEntityFields2 field in myEntity.Fields)
    {
         if (field.IsChanged)
         {
              // log something
         }
    }
}

Note that LLBLGen (since v2.5) has Auditing. You can use this to log changes like that. Please see the example in the LLBLGen Pro site.

David Elizondo | LLBLGen Support Team
gj1118
User
Posts: 30
Joined: 21-Jul-2010
# Posted on: 08-Nov-2010 03:55:23   

Thanks simple_smile