Mapping WF 3 activities to WF 4

by Matt Milner 26. June 2009 08:45

First, this post is not about any automated tools for mapping your activities, so don’t get too excited. :)   Instead, I wanted to take the opportunity to talk about the changes to the base activity library in the context of the activities available today in WF 3.  If you are using WF today, there are some activities that have direct counterparts, while others are split into multiple activities and yet others disappear completely.  Of course there are also some new activities that were not available in WF 3.  In the tables below, I outline each of these different categories with some notes.  Hopefully this mapping helps you see what is changing, what is new, and what goes away. 

NOTE: this information is based on Beta 1 of WF 4 and some changes are possible, though nothing big is likely, between now and the RTM. 

Activities with direct or indirect equivalents

WF3 Activity WF4 Activity Notes
Delay Delay The activity works the same, but the timers are handled differently in the framework.
Sequence Sequence  
Parallel Parallel Similar, but the internals of execution may differ slightly by RTM. 
Replicator ForEach<T>, ParallelForEach<T>,
ForEach, ParallelForEach
These provide <optional> typed access to the instance data and truly declarative authoring experience.  Each represents the different execution modes of the Replicator activity – so it has been split into four similar activities.  I think most people will use the generic versions more than the others, but time will tell.
CallExternalMethod InvokeMethod, InvokeMethod<T> Provides .NET method invocation and optional return of a typed return value.  This can be a call on an instance stored in a variable or a static method.
HandleExternalEvent Receive, ReceiveAndSendReply WCF messaging activities replace the Local communications model, even for host-> workflow communication. 
Listen Pick The Pick activity is the primary WF4 activity that replaces the Listen and the State which were both containers for EventDriven activities. 
EventDriven PickBranch This is an indirect mapping and you don’t use the PickBranch outside the pick, but it serves the same basic purpose of the EventDriven. 
Compensate Compensate Though the mechanism are slightly different, the activity serves the same purpose – to execute the compensation handler for a compensable scope. 
CompensatableSequence CompensableActivity The new activity includes a ConfirmationHandler which can execute when a confirmation is signaled using the Confirm activity. 
FaultHandler(s) TryCatch The try catch logic is more explicit now and you use the TryCatch activity to model your fault handling instead of using fault handlers on the composite activities. 
IfElse If In WF 4, this can only have two branches, the If and the Else.  For more branches, use the switch activity.
InvokeWebService Send, SendAndReceiveReply All web service communication in WF4 uses WCF. 
Throw Throw  
TransactionScope TransactionScopeActivity  
WebServiceInput (output and fault) Receive, ReceiveAndSendReply WCF is THE messaging system to use with WF.
While While/DoWhile WF4 introduces the DoWhile in addition to the While to ensure the first iteration executes.

 

WF3 Activities with no direct WF4 equivalent

WF3 Activity Note
ConditionedActivityGroup Based on limited use (my guess) this activity was not moved to WF4.
Code There is no code-behind file for workflows so there is no place to write code in the workflow.  Create custom activities or use expressions where appropriate. 
EventHandlingScope No real equivalent, probably b/c this is an activity that gets overlooked or people use the state machine instead. 
InvokeWorkflow In the Beta, there is no activity like this one.  One option is to host child workflows as WCF services and use the Send or SendAndReceiveReply messaging activities to start the child workflows. 
Policy In order to use rules in WF4, create a WF3 activity with a Policy activity inside it.  Create properties on the activity and use them in the policy definition.  Then use the InteropActivity to invoke the WF3 activity and execute the policy.  You can use the properties on the activity as input and outputs to the policy.
Suspend In WF4 there is more focus on having a “suspend on error” style exception handling, so direct suspend is not currently supported in the form of an activity.
SynchronizationScope Again, my assumption here, this was not used a lot by folks so didn’t get moved over. 
Terminate No direct option to terminate, but exception handling has changed so that when a workflow throws an exception, you can abort, terminate or cancel it. 
CompensatableTransactionScope In WF4, use a Compensable activity and put a TransactionScopeActivity in the body. 
State, StateInitialization, StateFinalization There is no State Machine workflow in WF 4. 

 

WF4 activities with no direct WF3 equivalent

AddToCollection<T> Helper activity to simplify declarative workflow development and manipulation of collection variables.
Assign Assigns a value to a variable – useful for declarative workflows. 
CancellationScope Allows you to define a scope of work and the steps to take if that work is canceled.  Replaces the cancelation handler in WF3. 
ClearCollection<T>  
Confirm Schedules the Confirmation logic for a Compensable activity. 
ExistsInCollection<T>  
Persist Explicit declaration of persistence from the workflow. Replaces the need for the PersistOnClose attribute on activities.
RemoveFromCollection<T>  
Switch<T> Provides multiple branches of execution each based on a specific result from evaluating an expression. 
Interop Executes a WF3 activity in the context of a WF4 workflow.  All public properties on the activity become In/Out arguments.  Custom designers are not supported. 

Tags:

Windows Workflow Foundation

WF, WCF, Dublin Pre-conference from Dev Days

by Matt Milner 22. June 2009 04:44

I had a great time at Dev Days doing the pre-conference session on WF, WCF and Dublin.  It’s always fun trying to present on beta technology, and there’s nothing like having the first demo crash Visual Studio to start the day. :)  Thanks to all who attended, you can find the demos here

Tags:

Windows Workflow Foundation | Windows Communication Foundation | Presentations

Slides and demos from my WF 3 –&gt; WF 4 talk at Dev Days

by Matt Milner 29. May 2009 03:44

Thanks to all who attended my talk on migrating from WF 3.x to WF 4 at Dev Days.  I’ve posted my slides and demos which you can download for review.  Thanks for a great show, and look for me to post some screencasts of several examples in the coming weeks. 

Tags:

Windows Workflow Foundation | Presentations

Slides and demos from my custom activities in WF 4 talk at Dev Days

by Matt Milner 29. May 2009 03:41

For those of you who attended my talk at Dev Days 2009, I’ve posted the slides and my demo code for the custom activities talk.  I’ve included the activities, the designers and the designer rehosting code along with some sample workflows using the activities. 

Also, look for some screencasts that I’ll be doing showing these activities; it will be like watching the demos all over again.

Tags:

Windows Workflow Foundation | Presentations

Speaking at Microsoft Dev Days 09 in Hague, The Netherlands

by Matt Milner 15. May 2009 05:41

I’ll be speaking at Dev Days 09 in a couple of weeks.  I’m excited to be doing a pre-conference day on WF and WCF 4 as well as “Dublin”.  then I’ve got two WF sessions during the conference, one on building custom activities with WF 4 and another on moving from WF 3.x to WF 4. 

devdays09logo

After the show, I’ll try to get some screencasts up of a few of my demos, and you can check out our Pluralsight On Demand! where I’ll soon be publishing some modules on “Dublin”. 

Tags:

Windows Workflow Foundation | Windows Communication Foundation

Issues with Live Mesh on Windows 7 RC

by Matt Milner 15. May 2009 05:06

I recently took the plunge and upgraded my 64 bit desktop from Vista to Windows 7 RC and for the most part I’ve been very happy with it.  So far the only compatibility issues I’ve had were with some CD / DVD mounting tools and Live Mesh.  I quickly realized how much I’ve come to rely on Live Mesh to keep files in synch between my desktop and laptop.  All of my presentations and writing that I do live on both machines and I have a Tools folder with small utilities like .NET Reflector, Notepad2, etc.  So when Live Mesh kept crashing under Windows 7, I got a little miffed. 

I started by trying to set the compatibility to Vista or Vista Service Pack 1, but that didn’t fix the problem.  I kept getting errors that the Mesh Operating Environment had stopped working and after closing it, it would restart, only to fail again in a few minutes.  So, I did what any self-respecting developer does when they have a problem they can’t fix: I searched the web.  Nothing, no love at all.  I saw a few things about recent updates, which I’d installed already, and some registry hacks for the Win 7 beta, which were already incorporated into later builds of the product.  So finally, I did the only logical thing, I uninstalled Live mesh, logged into Mesh.com and got the installer, and re-installed.  A quick reboot, and all seems well.  So, for those of you out searching the internet for a fix, hopefully this helps you out. 

Of course, this is on My Machine, which is a home built x64 machine with an upgrade from Vista SP 1 to Win 7 RC.  With all that in the mix, your mileage will likely vary.  ;)    

Tags:

General Musings

BizTalk Server 2009 Virtual Labs are now available

by Matt Milner 13. May 2009 11:18

Are you looking to try out BizTalk Server 2009 but don’t have the time to setup a full BizTalk environment?  Then Microsoft’s Virtual labs might be right for you.  The most popular labs for BizTalk Server have been updated for BizTalk Server 2009 and a few new ones focused on the features of BizTalk Server 2009.  Check them out if you are interested. 

 

In related news, I’m in the process of adding BizTalk Server 2009 content to the BizTalk Server Fundamentals course in  Pluralsight On-Demand!.  If you haven’t already subscribed, you should really check it out.  I’m spending my free time these days learning about Agile Team Practices from David Starr and ASP.NET MVC from K. Scott Allen.  It’s the next best thing to having these guys in a classroom with me.  We’re continuing to expand the library too, so the subscription gets more valuable by the month – not many investments you can say that about today!

Tags:

BizTalk Server

Screencast: Windows Workflow – Creating custom context channels for workflow services

by Matt Milner 5. May 2009 05:06

I’ve recently published a free screencast on how to create a custom context channel in workflow services. 

wf-custom-context-channel

.NET 3.5 supports managing context in a SOAP header or HTTP cookie, but that may not be where your context information lives. In this screencast I show an example of a custom channel that enables the context information to be passed in a URL to enable operation invocation from a link in an email.

 

Check out our growing collection of free .NET screencasts and videos.  Subscribe to the Pluralsight feed to be notified when new screencasts are published.  Also, check out our growing library of online .NET training courses -- see what you can learn with Pluralsight On-Demand!

Tags:

Windows Workflow Foundation | Windows Communication Foundation

Screencast: Windows Workflow – Managing conversations in workflow services

by Matt Milner 5. May 2009 05:04

I’ve recently published a free screencast on how to manage conversations in workflow services. 

wf-managing-conversations

Conversations are special cases of context management in workflow services requiring extra information to correctly route messages. In this screencast, I show you when you need to think about conversations and how to properly write your workflows and clients to deal with them.

 

Check out our growing collection of free .NET screencasts and videos.  Subscribe to the Pluralsight feed to be notified when new screencasts are published.  Also, check out our growing library of online .NET training courses -- see what you can learn with Pluralsight On-Demand!

Tags:

Windows Workflow Foundation | Windows Communication Foundation

new cloudApp() developer competition

by Matt Milner 5. May 2009 03:56

Looking to show off your skills in building cloud applications using either .NET or PHP?  Like to make a little $$ while you are at it.  Well, if you bring your A game, you just might have a shot in the new developer competition that Microsoft is running.  You can check out the details on the contest web site, and find links to all the tools you need to get started. 

I’m looking forward to seeing some cool ideas come out of this and participating in the community judging. 

From the website: 

new CloudApp() is a US-based developer challenge for .NET & PHP developers creating cloud applications or services (hereafter "application") on the Azure™ Services Platform. Have your application judged by industry leaders Om Malik and Michael Cote and share your cloud coding skills with other developers. Grand Prize Winners will be announced on stage at Structure 09 and featured on azure.com.

Unfortunately, for those of you not in the US, you read that correctly, and this is only open to folks residing in the 50 states and DC.  I’m sure it is for legal reasons, but that definitely limits the amount of cool submissions we’ll be seeing.

Tags:

General Musings

Pluralsight Developer Training

View my developer training videos on Pluralsight.

Pluralsight .NET Training