I am trying to extend the linqtosql classes generated by the VS constructor and need to determine if the value of a specific field has changed. Is there a way to access before and after values for a field in the DataContext update method for a table / object?
Here is my code:
public partial class DataClassesDataContext
{
partial void UpdateActivity(Activity instance)
{
this.ExecuteDynamicUpdate(instance);
}
}
I am also open to adding a property to the Activity entity class to let me know if a value has changed, but I can't figure out how to determine if a value has changed there. I can't just use the OnAssignedToChanged method of the Activity class because it fires whenever a property value is set, optionally changed. I am using the ListView control and LINQDataSource to update, so it is installed no matter what.
, OnAssignedToChanging, Activity, , . this.AssignedTo null.
partial void OnAssignedToChanging(int? value)
{
if (value != this.AssignedTo)
{
_reassigned = true;
}
}