How to Load WorkItems dynamically

Topics: CAB & Smart Client Software Factory
May 16, 2007 at 1:33 PM
hi Folks,

I am developing an application and i want to be able to load the name of the workitem say from a database and load the workitem within the RootWorkItem. I do not know the name of the application in advance. what i want is when a developer develops a use case, he creates a workitem and puts the name in the database. then the shell will load the name of the workitem from the database and then launch that particular workitem.

For example a developer develops a workitem called ContactWorkItem and puts an entry in the database with the name ContactWorkItem. then the rootworkitem gets the workitem name from the database and launch the workitem.

Help needed


May 16, 2007 at 4:56 PM
All you need to do is Create your own workitem say "MyRootWorkItem" inherited from the workitem,this workitem will be your RootWorkItem for yourapplication.Then have a method Add(string workitemname) inside this create a instance of the workitem dynamically and add to the CAB rootworkitem.

public class MyWorkItem : WorkItem
void Add(string workitemname)
WorkItem workitem = (WorkItem)Activator.CreateInstance(Type.GetType("YourFullNameSpace." + workitemname));


Hope this will help you

May 21, 2007 at 10:41 AM
my problem is i do not know in advance the name of the workitem. the name will be a string from the database so i would like to match what is in the database to an existing workitem. Say i return the string myWorkitem from the database i would then want to launch a workitem with that name.

Also does each view need its own workitem?
May 22, 2007 at 9:43 PM
Ok wat have understand from you is you already have all the wokitems avaliable in the RootWorkItem and u need to Activate specific workitem according to the value you get from DB.


When you register the worktems to the RootWorkItem make sure you give the same name as in your DB