Re: Adding child via AddNew leaves IsNew = false

Re: Adding child via AddNew leaves IsNew = false

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


preludecrazy posted on Thursday, March 27, 2008

Thanks Joe.

In fact, I've just looked into this deeper, and realised the IsNew of my newly added child was true afterall, and not false.  The reason why I presumed IsNew was false was I put a breakpoint at the top of my Update and Insert methods in LiteCompany, and it was jumping straight into Update - and I hadn't updated any rows, just added one, so I presumed it would only call the Insert method....

However I then suddenly realised something which seems really bizzare to me... In my DataPortal_Update method in LiteCompanyCollection (which derives from BusinessListBase [EditableRootList template]), it loops through each child in 'this', then if the child is new it calls Insert otherwise calls Update.  This seems sensible, but is sends 'this' (the parent/collection) as the parameter, not the actual child.  So you end up having to loop through the parent again in LiteCompany Update again (and Insert)!  This seems crazy, so surely it should be sending the child as the parameter?  I'm sure this isn't a bug, and I'm missing something, but sending 'this' just doesn't make sense to me...

 

Thanks.

Copyright (c) Marimer LLC