We have just moved from csla 2 to 3.8 and are having a strange issue when saving a collection.
We have made no code changes
The BusinessListBase object DataPortal_Update we persist the children as such
foreach (DocumentCommunication child in this)
else if (child.IsDirty)
And if you check the IsNew property of each child post insert they are all marked as old.
The collection is held in a windows form. After collection.Save we are finding that with 3.8 the child that has been inserted succesfully is still marked as New when inspecting the collection from the windows form, yet the code processes correctly and the child is marked as old when inspecting from within the collection.
So as we save this collection it consistently continues to insert the new objects even though they have already been inserted and marked as old.
What might we need to change to remove this behaviour?
I'm not sure what the exact implementations of your Insert() and Update() methods are, but sometime around CSLA 3.0 it became necessary to replace your existing references with the returned value from the data portal.
You have to write:
obj = obj.Save();
After any Save() call on an object, the previous reference is stale and should not be used again.
Copyright (c) Marimer LLC