How does LLBLGen detect a dirty field?

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 12-Apr-2005 01:21:55   

Hi there,

With a DataRow, all you have to do to make a column 'Modified' is assign to it even if you assign to it the value that it already has. So I end up doing something like the followingin order to save unnecessary updates.


int i = 3;
if ((int)row["Ordinal", DataRowVersion.Current] != i)
{
    if ((int)row["Ordinal", DataRowVersion.Original] == i)
    {
        row.RejectChanges();
    }
    else
    {
        row["Ordinal"] = i;
    }
}

Do I need to do this with the fields of an IEntity2 or is an internal check made to discern whether a field's value has truly changed?

Cheers,

Ian.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Apr-2005 09:23:58   

That's build in simple_smile So if a field is 5, and you set it again to 5, it's not marked as changed. If you set it to 6 and than back to 5, it is marked as changed.

Frans Bouma | Lead developer LLBLGen Pro