I’m looking for something like:
WorkItem item = CompositeUI…GiveMeTheWorkItem(this);
The code I’ve inherited is injecting the root workitem into everything which seems a bit long winded.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
figured I might as well try answering this as well for you. Based on my experience, I would have to say that what you are describing above is not available in the base CAB/SCSF framework.
The RootWorkItem contains a collection of child WorkItems which are created by your application to handle specific use case scenario. Each WorkItem contains a collection of smart parts and you can check if a WorkItem contains a specific SmartPart using the Get or Contains methods exposed by the WorkItem.SmartPart collection.
While I agree with you that injecting the RootWorkItem into everything is a bit “long winded”, if you use the WorkItemController base class for your WorkItems (which you should) then this is done for you in the base class.
As a possible solution, you could extend the WorkItemController base class with some sort of a FindSmartPart method which could traverse through the WorkItem collection of the RootWorkItem class and search for the SmartPart using the above mentioned methods.
Hope that helps.