Protected Overrides Sub DataPortal_Insert()

Protected Overrides Sub DataPortal_Insert()

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


SouthSpawn posted on Saturday, February 16, 2008

When does this Sub ever get called?

Right now, is looks like the .Save method on the Parent object always calls the
"Protected Overrides Sub DataPortal_Update()" no matter what.
 
What am I missing?
 
Thanks,
Mark

vdhant replied on Saturday, February 16, 2008

Hey Mark
I don’t know about older versions but in 3.5 save calls DataPortal.Update. This method intern eventually calls the Update method in the SimpleDataPortal. This Update method contains the logic that determines whether the DataPortal_Update should be called or the DataPortal_Insert or DataPortal_Execute, etc. It does this by looking at the various properties (and not necessarily object properties as in get/set but the type of the object etc) of the object being acted upon.
Hope that helps
Anthony

RockfordLhotka replied on Saturday, February 16, 2008

If you look at the code in SimpleDataPortal (described in Chapter 4) you'll find that it routes Save() calls to DP_Insert/Update/DeleteSelf based on the state of the object - for objects that subclass BusinessBase. For all other objects (like BusinessListBase or anything else) only DP_Update is called. The other exception are subclasses of CommandBase, where DP_Execute is called.

Copyright (c) Marimer LLC