Beginner Question about saving children lists

Beginner Question about saving children lists

Old forum URL:

TScorpio posted on Friday, April 15, 2011

I am new to CSLA and have a really basic question about saving children lists.
For instance:

I have a Editable root object that has a BusinesListBase in it. Within that list I have a collection of BusinessBase objects. The ListBase and Businessbase objects are both marked as children.

It's not a problem to get the root object to save itself, but I cannot understand how the collection of BusinessBase objects are supposed to be saved. Since the collection container and businessbase objects are all marked as children they can't issue thier own save methods right? The only savable methods exist in the root object so are you supposed to "pull" a childs value up to the root and save it from in there?

Whats the perfered setup for a situation of Editable root with lists of children in it?

I apoligize if if question is basic and stupid,  I just can't understand the idea of what should be going on.


RockfordLhotka replied on Friday, April 15, 2011

This is discussed in Chapters 17-18 of Expert 2008 Business Objects, and even more thoroughly in the Using CSLA 4: Data Access ebook.

The basic answer is that the parent calls FieldManager.UpdateChildren (to update all children) or DataPortal.UpdateChild (to update a specfic child).

Then each child type implements Child_XYZ methods to do insert/update/deleteself operations. The correct Child_XYZ method is invoked by the data portal based on the metastate of each child instance.

Copyright (c) Marimer LLC