Passing info between WorkItems

Topics: CAB & Smart Client Software Factory
Feb 7, 2006 at 6:49 AM
originally posted by: jhusain

One of the things I am struggling with is when to use the Event Broker. I assume that because it is used to decouple WorkItems it should be used across WorkItem boundaries and events local to a work item should be manually bound to event handlers? The reason that I ask is that I'm not sure how to pass information from one WorkItem to another.

Let's say, similar to the Bank Interest example, I have a large WorkItem dedicated to managing a list of BO's. If the user elects to edit a single BO a new Detail WorkItem is spawned. Following recommended practices, a copy of the BO is passed to the state of the Detail Work Item, ensuring that the Work Items are decoupled completely. When the user edits the BO and hits "Save" the Detail Work Item is unloaded. In order to reflect that change in the Parent Work Item's copy of the BO the parent work item needs to get it's hands on the BO from the Smaller work Item. Should the large work item subscribe to a ObjectSaved event published by the Detail Work Item and then update its copy of the BO using the copy passed in the EventArgs, OR should it just listen for the WorkItem_Unload event of the Detail Workitem and then pull the BO out of it's state?
Feb 7, 2006 at 3:29 PM
originally posted by: BradWilsonMSFT

EventBroker is about de-coupling components (any components, not just WorkItems).