Business Object Design Question (List Selection)

Business Object Design Question (List Selection)

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


Darrell posted on Monday, December 14, 2009

Hello, I'm relatively new to CSLA, which i have to say is really teaching me alot!

I am trying to figure out the correct object model for a very simple and no doubt common use case.

I need to display a read only list of items (transactions  - i.e credits, debits), to a user. The user should be able to select certain items from that list, and then they should be able to click a button to create a "Batch" containing those transactions that they have selected.

So my object model currently consits of:-

SelectTransactionsList - Read Only Root Collection
TransactionInfo - Read Only Child

The problem is, i am not sure whether the actual "Selection" should be "in-grained" into the objects or not.

In other words, should I add an "IsSelected" property to the child object, so that this can simply be databound to the ui? I can see a number of benefits to doing this, mainly that the Root List object can implement logic with respect to creation of the batch as it will "know" which of it's child items are selected. The appeal to going down this route is that ultimately it seems like less work for the UI.

However, something does not feel right to be about putting UI code like this into my objects.. Can someone please explain to me whether an "Is Selected" property would be justified / warranted? Or should i be going about things differently?

Many thanks

Copyright (c) Marimer LLC