Child object not being set to "clean" when saved.

Child object not being set to "clean" when saved.

Old forum URL: forums.lhotka.net/forums/t/2833.aspx


Jerrycurl posted on Monday, May 07, 2007

I'm sure there's something stupid going on in my code somewhere, but I don't know what it is.  I have a root class (Family) that has a collection of children (FamilyMembers).  I've got them all wired up to my UI, and at first I thought everything was working properly.  But then I noticed a problem.  If I edit a child object (FamilyMember) and then call the Save method (which is basically cut and pasted from the ProjectTracker program), the data is saved to the database, but the child's IsDirty remains true.  I can keep hitting the save button without making any more changes, and it keeps executing the update stored procedure because the object is never not dirty.  I can post some code and more details if needed, but I thought maybe someone could suggest something first.  Any ideas of what might be going on?

mr_lasseter replied on Monday, May 07, 2007

Are you calling MarkOld in the DoInsertUpdate Method on the child object?  If not, this is were your problem is.  This function sets the changes IsNew to false and IsDirty to false.

Mike

Jerrycurl replied on Tuesday, May 08, 2007

That was the problem.  Thanks.

Copyright (c) Marimer LLC