RootObject with Editable ChildList containing Read-Only Child Objects ?

RootObject with Editable ChildList containing Read-Only Child Objects ?

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


alex.enjoy posted on Wednesday, April 18, 2012

Hello,

please assume you have users and group.
Each user can be a member of many groups.

The UI should display the users details and a list of referenced groups.
Additionally it has to be possible to remove selected groups,
and to add a group selected by a separate combo-box containing available groups.

My idea was to create the following stereotypes
 - UserEdit as EditableRoot Object
 - GroupList as Editable Child List
 - GroupInfo as Read-Only Child Object

Unfortunately it seems that an EditableChildList cannot contain Read-Only Child objects.
What do I miss here?
Why has the Group object to be an editable object? I only want to display informations of it.
Only the referencing list has to be modified, but not the containing elements.

Thanks in advance,
Alexander

 

JonnyBee replied on Wednesday, April 18, 2012

An editable list will only accept editable objects that implements:

ISupportUndoIUndoableObjectITrackStatus

IE: Can participate in N-Level undo and keeps track of whether they are dirty or not.

ReadOnly objects do NOT implement these interfaces and cannot be used in an editable list.

You do NOT only want to display information - you must also know whether item status is IsDeleted, IsNew og none (existing).

And the list has an "owning" reference to all it's child objects - so they CANNOT be owned by multiple lists in order to participate in N-Level undo.

Copyright (c) Marimer LLC