ManagedObjectCollection: same for WorkItem/Command

Topics: CAB & Smart Client Software Factory
Oct 4, 2006 at 7:20 AM
originally posted by: BobPace

This is more of an observation than anything. It seems that the _rootWorkItem.Commands collection and the _rootWorkItem.WorkItems collection are not two seperate collections but rather part of one base ManagedObjectCollection in which all these objects are stored and can serve up whichever object is needed through a string id.

In our project we had several CommandHandlers set up with id's to reflect the business module that they were registered in. Later we decided to give each ControlledWorkItem an id so we could pull the ones we wanted up from the _rootWorkItem.WorkItems collection. It so happened that we used the same id for our workitems that we used for the commands, thinking that they were in two seperately managed collections and and such having the same id would not matter because for the scope of that collection it would be unique. Then we started getting exceptions of 'can not cast a Command into a WorkItem' and after closer observation realized that all id's have to be unique because they are all really part of one big managed collection.

I assume this is the same for the _rootWorkItem.SmartParts collection as well.

Is this right?