Should i explicitly call MarkClean() in update method of editable child?
Should i explicitly call MarkClean() in update method of editable child?Old forum URL: forums.lhotka.net/forums/t/4869.aspx
Lalit posted on Tuesday, May 20, 2008
I have a scenario where a BusinessBase class is having an editable child collection. I implemented the update method as internal for this child colletion which in turn calls internal methods for insert, delete or update of its editable child depending upon the flag values. Now my question is do i have to call MarkClean() or MarkOld() method explicitly in update method for this editable child?
Lalit replied on Tuesday, May 20, 2008The version i am using is CSLA.net 3.0
ajj3085 replied on Tuesday, May 20, 2008It depends on the operation. For insert or update, MarkOld should be called. The that will mark the object as both clean and old.. old meaning it exists in the database.
For delete, MarkNew should be called. It sets the instance as dirty and new, or not existing in the database. Since clean tells you if the object has changed since it was loaded from the db and the instance doesn't exist in the db, it's by definition dirty.
Copyright (c) Marimer LLC