Brad Wilson - The .NET Guy

Technologist. Agile Evangelist. Poker Player. Amateur Neologist. Metalhead.

My Links

Post Categories

Article Categories

Archives

Blog Stats

Stuff

CAB, June to October: The Big Changes to WorkItem

This post discusses changes to the Composite UI Application Block as of the October 2005 CTP release.

WorkItem is a core class, and underwent quite a few changes between the June CTP and the October CTP.

The most obvious change is that the collection-like behavior is not present on the WorkItem itself any more. Components (which we'd prefer to call Items now) are available in a collection class property called Items, and services are available in a collection class property called Services. This means calls like:

   myWorkItem.Add(...);

become:

   myWorkItem.Items.Add(...);

And calls like:

   myWorkItem.AddService(...);

become:

   myWorkItem.Services.Add(...);

In addition to these two core collection classes, there are a number of fascade classes that filter these collections. For example, to find just the IWorkspace classes in a WorkItem, you can use myWorkItem.Workspaces.

We also renamed "Create", because it wasn't quite clear what it did. The new name is "AddNew", which lets you know what the WorkItem is making a new one and adding it. The AddNew method is available on both Items and Services.

As before, you can inject services with the [ServiceDependency] attribute, and items with the [ComponentDependency] attribute.

We've added a new attribute called [CreateNew], which indicates that during injection, you'd always like a new one of the thing created. This attribute is a more general purpose form of (and replaces the) [Controller] attribute. This attribute helps write MVC/MVP style applications much easier by automatically allocating a controller or presenter as necessary.

posted on Sunday, October 09, 2005 8:00 AM