mapping UI design to CSLA classes - not always clean

mapping UI design to CSLA classes - not always clean

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


kayakheaven posted on Friday, December 22, 2006

Hi, I have a couple of UI designs that don't seem to map cleanly to CSLA base classes so I'm wondering if anyone can offer insight how to approach this.

1) Quasi read-only grid with editable children
UI design presents a screen with grid (list) that does not have any Save button, only Open, New and Delete. Select a row and open details screen which has Save button. Once this Save is clicked the record is saved, details screen closes and the grid screen refreshes. New button opens the details screen with a new record. Delete button deletes currently selected row in grid immediately, no extra Save or Update.

This UI scenario doesn't map nicely to the editable BusinessCollectionBase and editable child BusinessBase.

We worked around it using a modified ReadOnlyCollectionBase and modified BusinessBase.

Another option was to drop the separate details screen with its Save button and allow editing in the grid which would bind to a BusinessCollectionBase with BusinessBase children. Not sure the user would have wanted that.

Can anyone offer any advise on our choice? We are using CSLA v1.5.x with .NET v1.1 & VS.NET 2003.

ajj3085 replied on Friday, December 22, 2006

It sounds like you can use a vanilla ReadonlyListBase.

Each item in the collection could have a GetEditableObject method, to support opening.  The EditableObject class would also have a static factory Delete method, which could take an instance of the readonly object to actually perform the delete.  New works by creating a new object and opening the editing grid.

The grid shouldn't really support editing of children, this should be done in the main edit screen (with possible exception of a factory Delete of a child method.

That's the method I would go, and it seems like that's almost what you do (although not sure what modifications you've done to the readonly list.  In what way do you think that doesn't fit together well?

Andy

kayakheaven replied on Monday, January 01, 2007

Here is my second example UI design issue

2) grid with virtual rows

UI design presents a screen with grid that has a summary row, or some other row that does not correspond to a real data point. In my BusinessCollection class DataPortal_Fetch method after looping over the data reader to List.Add() objects to the collection I write some code to add the extra virtual object (row) to the collection (grid), but various anomolies occur.

For example:

- in a master / detail scenario the virtual master object is a placeholder for all those details that don't have an explicit master object, but the virtual object wants some properties to be "null" since they have no value. CSLA objects in collections are strongly typed versus ADO.NET DataTables which allow row / column null values, so integer zeros or other default values appear in UI grid

- when the grid is sorted in the UI, the summary rows should always appear at the bottom

Has anyone tackled these kinds of scenarios with CSLA? How did you handle them?

Brian Criswell replied on Monday, January 01, 2007

There has been a lot of discussion on item #2.  Do a search of the forums for "line item" or "lineitem."

Copyright (c) Marimer LLC