Confusing myself with the stereotypes

Confusing myself with the stereotypes

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


reagan123 posted on Thursday, January 12, 2012

Okay, need some help here.  Our old UI had a use case where we basically displayed a grid that was bound to a read only info list.  When the user selects an item from the grid, we grab the id from the info object and fetch the editable object, bind it, and allow them to edit... No Problems...

i.e  
Person
PersonInfo
PersonInfoList

Now we want to experiment using an editable root list.  I thought I could just load the editable root list collection with my existing Person object, but it doesn't seem to be working.  It fails when the item is being added saying it can't be added since it's not marked as a child.

Can someone please help me out... I'm sure it's simple, but I'm scatterbrain at the moment :) 

skagen00 replied on Thursday, January 12, 2012

Generally speaking EditableRootLists have been in many respects discouraged (there are some cases where it can make sense) - I suppose it depends on how much information you have on each person and how much you intend to display when listing people.

Is there a particular motivation towards moving towards an editable root list?

I've had a case where adding/editing/etc items off a read-only list leveraged an editable object and then modified the underlying readonlylist through refreshes of particular items or additions of new info items & such - perhaps that would be a better avenue.

JonnyBee replied on Friday, January 13, 2012

Hi,

Obviously your Person object is a "root" object.

As such you can use it in a DynamicList object that will work much like the datagrid in SqlServer management studio and automatically save the changes when you move to another object in the list.

If you want to use Person in EditableRootList it can only be a "child" object that can only do Save/Delete in the context of a Save on the entire EditableRootList object.

reagan123 replied on Friday, January 13, 2012

Thanks for the replies.  I'll elaborate my actual use case a bit to see if you guys have any good suggestions.

The idea is that I need to display a list of inspections to the user, such as "Check Oil in Car".  This list has a child collection of schedules stating how often the inspection is due, such as "Every 3,000 miles" or "Every 3 months".

What i'm trying to do is to display this to the user.  The user needs to be able to edit both the Inspection information and the scedule information.  How would you guys model your objects for this? 

Thanks for the responses so far.

Curelom replied on Friday, January 13, 2012

The scenario you explain would work if you list your schedules as a EditableChildList  with the Person being an EditableRootList.  If you need to edit Schedules all by themselves outside the context of Person, you could make them switchable, which are essentially objects that have logic for both Root and Child.

Copyright (c) Marimer LLC