By Greg McGuffey - 10/18/2007
I'm about to subclass the BusinessLayer type to handle some auditing. I'll need to know if a record is a new record. I was going to override the Save method (or maybe the OnBeforeSave method). In this I'll need to figure out if the record is new. If it isn't new, I'll need to save away the old values to my audit history table, but I won't need to call this for new records.
My first thought was to check the PK field (which in my case will always be an integer/identity field), to see if its value was < 0. Is there a better way?
Thanks!
|
By Peter Jones - 10/18/2007
Hi Greg,I think: If BO.CurrentRow.RowState = DataRowState.Added Then...... End IfWill do the job Cheers, Peter
|
By Greg McGuffey - 10/18/2007
Ah...great idea. I'll try that.
Thanks Peter
|
By Trent L. Taylor - 10/19/2007
Yeah, Peter has the right idea. The best way to determine a state of a row is by using the RowState.
|
|