Seeking Design advice (Silverlight / MVVM )

Seeking Design advice (Silverlight / MVVM )

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


Jack posted on Friday, June 17, 2011

I'm looking for some general design advice as I revamp my framework and core application to 4.x.  I have a lot of old and poorly designed code due to it being a first time CSLA project and Silverlight etc. etc.

My biggest struggle seems to be about how to handle subsets of data.  My application is 90% readonly but involves lots of slicing and dicing on the same data from different perspectives and then performing single or bulk operations across select chunks.  Some of those chunks represent children in a hierarchial relationship so that means refreshing parents and potentially checking the relationships between children.

The easiest example is that I have a DataEntryTask object in the system that at the bottom level belongs to a participant.  One has to manage and ultimately enter test data for a single subject.  The task has a schedule and various states (completed/cancelled/entered/ and then time related info).

However there are umpteen ways of dealing with the task depending on one's role.  I need to manage:

All project tasks
All tasks at a site (1:x projects)
All tasks assigned to Resource X
All tasks for Participant Y
All tasks for Test Z

etc.

Each scenario uses the same basic object but influnces different parts of the workflow.  This means a lot of re-use of the same data so I'm trying to avoid huge data retrievals.

What I'm finding is that I built giant UOW object and then pulled back ReadOnly lists and EditableLists.  I'm then wrapping the individual items in ViewModels and presenting them to the UI that way.  In essences I don't seem to care about the xxxList stereotypes as they just seem to get in the way.  I still need the UOW objects as they load and manage all the lookup tables etc. but I'm struggling on how to better manage this.  I do a lot of loading a subset of data and then appending and then removing / refreshing etc.  That doesn't work at all with the existing list StereoTypes.  I'm really just using them as a transfer mechanism through the data portal (maybe not such a bad thing).

I'm wondering if I would be better served with a set of CommandObjects that pulled lists from the DB and then my UOW just dealt with IEnumerable<MyClass>.

Maybe I don't need to be using xxxList objects and just having managed properties that are List<xxx> instead? 

Thanks

jack

Copyright (c) Marimer LLC