BusinessListBase<T, C>.DataPortal_Update() question

BusinessListBase<T, C>.DataPortal_Update() question

Old forum URL:

kosta_t posted on Thursday, October 07, 2010

I am trying to use BusinessListBase as a root collection object in a test application, using cslacs-3.8.4-100811

The documentation in 'Expert C# business' objects states "    The BusinessListBase class includes a default implementation of the DataPortal_Update() method, which loops through all child objects (and deleted child objects) to ensure the appropriate Child_XYZ method is called on each when the collection is being saved."

However when I tried to use this default method I saw NotSupportedException exceptions being thrown.

Upon inspection of the source code, I see that the default method is in fact just a stub and its aonly action is to throw an exception.


Does this mean that I need to write my own DataPortal_Update() every time I derive from BusinessListBase?

is there a more elegeant solution.

JonnyBee replied on Thursday, October 07, 2010

If you want to use a BusinessListBase as a root object then yes -  you must override and implement DataPortal_Update.

The root object should handle transaction and own the DataBase connection, Linq2Sql context or EF context.

When a BusinessListBase is a child in a parent object (BusinessBase)  you can use FieldManager.UpdateChild or FieldManager.UpdateChildren in the parent that will loop throug the child list  and call Child_Update/Child_Delete on the items.


kosta_t replied on Thursday, October 07, 2010

ok, thanks

Copyright (c) Marimer LLC