Mark Child as Old

Mark Child as Old

Old forum URL:

Brendt posted on Wednesday, July 31, 2013

Good day.

i would like to know how i would go about marking my child objects as old directly after saving them. in my application i have a 'New', 'Preview' and an 'Edit' form, the way i would like it to work is that the user can create a new Parent (customer) and add addresses (children) after clicking save i open up the preview form of the objects that were just saved (parent + children) the user then has the option to either click Edit again or close the form. The problem i have is that my children objects are still flagged as IsNew = True, so if the user chooses to click the edit button and save again my child objects are getting re-inserted into the Database as new objects. How can i mark the children objects as old objects after the save?

i have tried 'MarckOld(obj); and base.MarkOld(obj) but this does not seem to work. could you please tell me how to accomplish this?

Thank you in advance.

JonnyBee replied on Wednesday, July 31, 2013

Save method returns a new object with correct state. 

var o = o.Save()

and it is the new object that you an continue work on.

And when you save the child objects you must also call MarkOld each child.

Brendt replied on Wednesday, July 31, 2013

thanks JonnyBee...once again top notch advise. Got it working perfectly.

Copyright (c) Marimer LLC