DynamicListBase missing Parent Property

DynamicListBase missing Parent Property

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


thaehn posted on Monday, June 03, 2013

Is there a specific reason that the DynamicListBase doesn't have a "Parent" property or is it a bug?

Todd

JonnyBee replied on Monday, June 03, 2013

Hi,

A DynamicListBase is by definition a parent object that automatically saves it's "root" objects contained in the list. It makes no sense to have a parent property on this list. 

thaehn replied on Tuesday, June 04, 2013

Jonny,

To me, the Parent is the object that hosts the object; it doesn't have anything to do with the steriotype. 

RockfordLhotka replied on Tuesday, June 04, 2013

The way CSLA thinks about a "Parent" is not simply an object reference - it is a real parent-child relationship (also known as containment).

DynamicListBase implements aggregation, not containment, and so the Parent property would be misleading.

What is the scenario where your root object needs to know that it was loaded as part of a collection?

thaehn replied on Wednesday, June 05, 2013

I have a "getter" object at the root which holds all my lists (product types, codes, etc.) and my business object root as I load everything I need up front in Silverlight when I open a new view.  The business object is a dynamic list of root business objects.  I lazy load another list on the business object when selected in the UI through data binding.  I need access to the list of product types in the "getter" object in order to pass it into the data portal through a criteria object.  Typicaly I reference the Parent object to get to the root "getter" object that has my lists on it.  I also sometimes need access to the "getter" object in business rules where I only have a refernece to the target and not the "getter" object.  I have been using the DynamicListBase for an interface simular to Billy Hollis's Temp Agency demo application.  By having the business objects referenced on the main form for the module, I can tell if they are new, dirty, etc. even though they are actually being edited in another viewmodel/view.

Todd

Copyright (c) Marimer LLC