What's New in Windows Workflow Foundation in .NET 4.5 (part 1)
During the last //build/ conference a number of new WF4, or should I now say WF4.5, features where announced. While the list of new features isn’t earth shattering long some of the most annoying shortcomings where addressed.
As a developer I spend a lot of time in the designer so any improvements there are going to make me happy. And I am very happy to see some of the new features.
Auto surround with a Sequence.
This seemingly small feature is a real time saver. There are lots of places where an activity has a child activity to execute, for example an If activity has a Then and an Else and executes either. These are of type Activity so by default you can add a single activity there. At runtime this is no problem. Want multiple child activities? Just add a Sequence and you can add as many child activities as you want. The problem is that in the designer that means removing the existing child (you can put it on the clipboard), adding a sequence and finally re-adding the original child. Not difficult but somewhat cumbersome and I never like deleing something I need and saving it on the clipboard.
No longer Now we can just drag a new Activity and the designer will automatically wrap the existing activity in a Sequence. So much easier and a much nicer way to work!
Another feature I missed greatly was adding comments to an Activity describing its intent. All we had was the DisplayName and that was not much of a replacement. Fortunately we now get Annotations allowing us to add more information about the intent.
Searching through workflows is another big one. With small workflows it is quite easy to see where a variable is used but when workflows get bigger this becomes an increasingly hard problem. With WF4 I typically solve this by opening the workflow XAML in a text editor and searching the raw XML. While this works reasonably well it is less that perfect and one of those tricks you need to pick up while working with WF4. The new search capability will let you search through a workflow in the designer, as you really should, just as any other Visual Studio artifact. Another great improvement
Multi-select of activities
As soon as you start creating flow chart or state machine workflow you will quickly find you have to rearrange the existing activities to make place for a new one. Seems simple enough to move them right? Well you are wrong as the designer only lets you select a single activity at the time so you can’t move a group of them in one go
Well no longer as we can now select multiple activities and drag them around as a group
This is by no means the complete list of changes, here you can find a more complete list, but these are the ones I think most people, myself included, where really missing. Glad to see them being added, now if only we could get to work with them today