IsChild not checked by FieldDataManager in GetChildren or UpdateChildren?

IsChild not checked by FieldDataManager in GetChildren or UpdateChildren?

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


cslagrue posted on Wednesday, September 03, 2008

Hi, I'm trying to understand the details of the new managed properties model since it still isn't very well-documented yet (can't wait for the new book, Rocky!).

It looks like the FieldDataManager assumes all managed fields are children, regardless of whether MarkAsChild was ever called on them.  In GetChildren() and UpdateChildren() it only checks to see whether a field implements IEditableBusinessObject or IEditableCollection in order to see if it qualifies as a "child" for list inclusion or cascaded updating.

Is that correct?  If so, is that the intended behavior?

RockfordLhotka replied on Wednesday, September 03, 2008

That is correct and intended. If you store a field reference to another object that is an implicit containment or aggregation relationship, and in CSLA tems that expresses a parent-child relationship.

If you explicitly don't want such a relationship then you should use a private backing field, with that field marked as NotUndoable and probably NonSerialized.

You can still use a PropertyInfo<T> and GetProperty() to implement the property, but not a managed backing field.

Copyright (c) Marimer LLC