[3.5.1] ChildDataPortal MarkOld
[3.5.1] ChildDataPortal MarkOldOld forum URL: forums.lhotka.net/forums/t/5424.aspx
Adalton4 posted on Thursday, September 18, 2008
In the ChildDataPortal method 'Fetch', the call to MarkOld() is done before the actual call to the Child_Fetch method in the child object. This is inconsistent with the logic in the Update method, where it is called after the call to the child objects Update_Child or Child_Insert methods. I have overridden my MarkOld() methods to set some concurrency fields and other stuff who must be fired after they are loaded. So now i am forced with writing a manual call to MarkOld() in the Child_Fetch method, but wasn't it the intention to make this stuff automated?
Thanks in advance for your response.
ajj3085 replied on Thursday, September 18, 2008But it's consistent with the normal DataPortal Fetch.
This is done because there are many cases where business rules change after the object is saved. When rules are check in a Fetch, these rules will be wrong if the MarkOld call was done after the DP_F, because IsNew was true. The change was made to allow for this, and it makes sense.
MarkOld is called AFTER the insert / update, because the object now exists in the database. So IsNew is set to false after the actual insert has completed. Again, this makes sense, because IsNew indicates if the object exists in the database.
So, when you consider what IsNew means, the calling of MarkOld / MarkNew is consistent.
I would say that MarkOld isn't the appropriate place to set your concurrency fields; you should be doing that in the fetch, or possibly in the DataPortalComplete method.
Copyright (c) Marimer LLC