How to implement a multiselect child list which changes based on some root property

How to implement a multiselect child list which changes based on some root property

Old forum URL:

Helius posted on Friday, December 07, 2012

I will try to go directly into detail. I want to implement with CSLA a business object which will support the following:

  1. The Editable Root Object will have details about the Employee , including the Department in which he works.
  2. The Employee can do a list of tasks, which will be the Editable Child list of my Employee Root Object and will be implemented in the user interface through a multiselect grid.
  3. The list of task changes based on the department, so each department will have a specific list of tasks and each employee, member of that department can do only a subset of the list of tasks defined for the department.

Could you please advise me what it is the best way to implement this situation in CSLA?


skagen00 replied on Friday, December 07, 2012

I have actually done something like this before in a manner that is probably a little unconventional.

To draw an analogy, I would have ended up creating a EmployeeSelectableTaskList - this EmployeeSelectableTaskList would be fetched depending on the department of the employee and would do a "refetch" (async on propertyhaschanged in our case) upon department change.  The list would be composed of a list of all possible selectable tasks.  The EmployeeSelectableTask would contain an IsSelected property. 

Fetching would bring back all possible tasks (not just those selected) - in my case it is in the neighborhood of 20-30 so it's totally acceptable.  If it were hundreds, probably not acceptable.  Persistence is short circuited for the children such that the root object looks @ the child collection and what is selected and handles the persistence itself.   In our case, we're somewhat indiscriminate and we just wipe out existing tasks and re-insert selected tasks.

The nature of this allows for a very simple databinding experience in our scenario (Silverlight app for us).  It works really well in the scenario we use it for.


Copyright (c) Marimer LLC