Problem with WorkItems.AddNew<MyWorkItem>("MyID")

Topics: CAB & Smart Client Software Factory
Dec 8, 2005 at 11:09 AM
originally posted by: danipham

I cannot add a new WorkItem with my custom ID.
WorkItem workItem = _rootWorkItem.WorkItems.AddNew<MyWorkItem>("MyID");
returns a workItem with the default ID (Guid) and not the specified ID "MyID".

It seems to be a bug in ObjectBuilder, could you confirm that?
Dec 8, 2005 at 11:40 AM
originally posted by: BradWilsonMSFT

The ID you look up an object by is not the same thing as the ID used by the Workitem for loading and saving state. The ID property on the WorkItem is the latter, not the former. If you want them both to be the same then:

WorkItem workItem = _rootWorkItem.WorkItems.Addnew<MyWorkItem>("MyID");
workItem.ID = "MyID";
Dec 8, 2005 at 11:57 AM
originally posted by: danipham