Skip to main content

Introduction to Workflow Foundation 4 (WF4)

I finally decided to pick-up my blogging once more. Since I have been trying to learn Windows Workflow Foundation 4 (WF4) I thought I might as well start off with this topic.

WF4 is a development framework that enables you to create a workflow and embed it in a .Net application. It is neither an executable application nor a language. It provides a set of tools for declaring a workflow, activities to create your logic and to define control flow and a runtime for executing the resulting application definition. It also provides services for persistence of state, tracking and bookmarking. You can create your workflow directly in code, in mark-up or in a combination of both.

Workflow provide us with two major advantages -
  1. Creating unified application logic.
  2. Making application logic scalable.

Workflow Authoring styles - Sequential Workflow executes a set of contained activities in a sequential manner.

Workflow Foundation was introduced in the .Net 3.0 and updated in 3.5. In .net 4 it has been completely revamped leaving with us two set of assemblies -

  1. System.Activities.* assemblies for new framework components.
  2. System.Workflow.* assemblies for backward compatible framework components.

Changes in WF4 include -

  1. Better workflow designer based on WPF.
  2. WF4 now has a concise model for data flow and scoping by making use of arguments and variables.
  3. A new FlowChart activity to help define workflow in flowchart model.
  4. A revamped WF programming model with Activity as the core base class that is now fully declarative composition of activities. So no code beside file just the xaml is sufficient.
  5. Enhanced integration between WCF and WF with new messaging activities, message correlation and fully declarative service definition.

Activities the building blocks for workflow -

  1. All activities derive from Activity.
  2. Activity represents a unit of work in a workflow.
  3. Activity used as a top level entry point is called a workflow.
  4. Activity can contain other activities forming a tree like strucutre.

A sample workflow in code would be like as below -

Sequence workflow = new Sequence
{
new Writeline { Text = "Hello" },
new Writeline { Text = "World" }
}

I would be continuing on this topic in the coming weeks highlighting how to use different types of activities to create workflow in code and how to create and use custom activities.

Comments

Popular posts from this blog

Health Framework - Apple vs Android

In the past few years we have seen mobile and its apps rise and shine transforming many industries in its wake. However, the growth in health and fitness category has been less spectacular at 49% compared to overall mobile app industry which grew at 115% in the year 2013 (source Flurry Analytics). A few years ago Microsoft and Google attempted to make inroads into the health and fitness sector by bringing web based products to store and maintain health and fitness information like MS HealthVault and Google Health with not so spectacular results. Next came innovations by Fitbit in the wearables sector for activity tracking, in 2011 and 2012 they introduced first wireless activity trackers to sync using Bluetooth. This was followed by the entry of Jawbone into health sector with its announcements of Up wristband and accompanying app. These have had better success resulting in many startups joining the wearables product bandwagon.  Late to the stage almos...

Notes on Castle MonoRail

  Sometime back I was doing a small POC on Castle MonoRail. So here are my quick notes on this. MonoRail is an MVC Framework from Castle inspired by ActionPack. MonoRail enforces separation of concerns with Controller handling application flow, models representing data and View taking care of the presentation logic. To work with MonoRail you need Castle Assemblies. It also utilizes nHibernate You can use Castle MonoRail Project Wizard or create the project manually. Project structure – Content Css Images Controllers HomeController.cs Models Views Home \ index.vm Layouts \ Default.vm ...

Quick notes on Git

  I have been away from writing anything for a long time and instead have been fooling around with other stuffs like just plain reading, growing mustache, trying to learn swimming, trying to learn to play acoustic guitar and trying my hands at photography. To be honest I have not given up on them yet but neither have I been able to hang on to them in a disciplined manner. So here I am back to my writing after a long gap. This time its going to be quick notes on Git . Git is a file repository. As opposed to other repositories like SVN Git thinks of its data more like a snapshot of a mini filesystem. All operations in Git are local. (Entire history of the project is stored locally in your working directory) Browsing project history. Viewing all changes to a file. Git uses Checksum to track repository items Everything in Git is check-summed It uses SHA-1 hash for generating check sum values All a...