Chapter 9. Using the New Capabilities of WF

In this chapter, we will cover:

  • Creating a state machine workflow
  • Using the enhanced designer features

Introduction

WF, which stands for Workflow Foundation, was first presented in society almost six years ago on November 2007 as part of .NET 3.0. Now it comes to us as a greatly enhanced framework with polished features and some sweetness under its cape.

WF 4.5 has softened the edges that were still present in 4.0 and now offers a state machine workflow model, so we no longer have to simulate it with flowcharts or use the CodePlex state machine .

It is interesting to note that the CodePlex state machine project, which can be found at http://wf.codeplex.com/releases/view/67992, is a predecessor of the current state machine—it was put out as soon as WF4 was shipped to get feedback from the community early on.

It comes with many enhancements that the community has been asking for, such as C# expressions. The list of designer improvements is long: panning, search with navigable results, quick find, a document outline, autosurround with sequence, annotations, multiselection for activities, auto-connect, and auto-insert. Another useful addition is the build time workflow validation, and errors in the XAML file will now break the build. To top it off, workflow validation is executed in the background while in the designer.

We now have WorkflowIdentity , which basically gives us the ability to associate a name and version with a fully configured definition; identity is configured at the host level and all instances are annotated with that identity that lives through the life cycle of the activity.

We have the ability to use side versioning as well, where we can have multiple versions of the definitions of a workflow executing at the same time.

Additionally, we have workflow versioning called DynamicUpdate with dynamic update capabilities, so now we can update a persisted workflow to a newer version. It is possible to run different versions side by side.

On the activities side, we now have NoPersistScope and some additional capabilities, such as validating the unconnected nodes and the DisplayName property.

Activity templates can now be generated from the contract with the new Contract First development mode. This allows us to generate the operations for the contract, given that we have an existing WCF contract, to generate a set of activities to represent the operations in it. Contract First also allows us to validate a workflow; this means that if a workflow claims to have implemented a contract, it should implement all its operations as well.

This Contract First is "opt-in," so we can use the usual authoring to create activities or use Contract First.

If all of this wasn't enough, Microsoft is bringing WF to the cloud, which clearly states the importance of the .NET workflow "de facto" framework.

Finally, workflows can now be run in partially trusted application domains, obviously with less permissions and capabilities.

In the following sections, we will see how to create our first state machine workflow and how to use the main designer's new features.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset