UI Design and saving children objects

UI Design and saving children objects

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


FreeAsInBeer posted on Monday, March 12, 2007

Hi all,

this question is in two parts - asking your general thoughts on UI design and then asking how best to achieve that using CSLA.

Imagine this simple class structure (I'm making this up as I go, so please bare [sic] with me);

Car (BusinessBase)
Accessories (BusinessListBase)
Accessory (BusinessBase - child)
Defects (BusinessListBase)
Defect (BusinessBase - child)

So we have a Car, and that car has two collections (a list of accessories and a list of defects).

My UI is WPF, and I was going to display and edit the Car and its children using a TabControl. So 3 tabs are needed; Car, Accessories and Defects.

My question re UI is this;

Should I have a button at the bottom of each tab labeled "Save/Update Car". I'm not worried about the wording, but more the function. This save calls Car.Update(), which in turn saves the Car and its children (ie both lists). The reason this worries me is the user may be saving changes that they cannot currently see. If they are on the Defects tab, and some of the Accessories are Dirty, the Accessories will be saved at the same time.

Should the user be able to save each child list independently?
Does this 'break' the core CSLA design?
What if there are validation exceptions on multiple tabs?

thanks
FaiB

ajj3085 replied on Tuesday, March 13, 2007

First, I wish I could be using WPF... soon I hope. Wink [;)]

If your form resemblies a property page, then the behavior you describe would be expected.  Users do that all the time on things like the Display Properties control panel.

The answer to your question,should the child lists be savable independately depends on your use case.  If the use case is worded in a way that the user is editing all this data at the same time, then you should stick with the current design.  If there's a use case where the user can edit Defects or Accessories without editing a car, then you would want to make Defects / Accessories root objects.

Remember, a root object is the one which controls transactions; anything that MUST be saved when a root is saved must be a child of that root. 

Copyright (c) Marimer LLC