Friday, February 09, 2007

* Windows Workflow Foundation (WF) : An Overview

With .NET 3.0, Microsoft released a new infrastructure for developing, deploying and maintaining workflow aware applications.

The .NET 3.0 composition can be expressed as below :

.NET 3.0 = .NET 2.0 + WCF + WPF + WF + CardSpace

WCF is Windows Communication Foundation for distributed computing, WPF is Windows Presentation Foundation for building interactive UI, WF is Windows Workflow Foundation and CardSpace is an identity management framework.

WF can be defined as a composition of the programming model, engine and tools for building workflow enabled applications for Windows platform. This is the single workflow technology which will be used by all Windows products and also custom applications build for windows platform.

As in real world, workflow in WF is also a set of activities where the control can go from one activity to another based on decisions or rules.

WF supports three kinds of workflow authoring styles :

  • Sequential : Workflow executes from start to end and can take one of the various paths based on decision rules
  • State Machine : Workflow transitions from one state to another based on events until it reaches the final state
  • Data and Rules driven

WF architecture mainly consists of following components :

  • Runtime Engine : Responsible for executing workflow in managed environment
  • Runtime Services : Responsible for scheduling, tracking, monitoring and integrating workflow with other applications
  • Base Activity Library : Set of pre-built basic libraries. Custom activities can also be developed.

In programming terms a workflow can be defined as a class in code file or defined in markup file.

 

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

namespace HelloWorldWF
{
public partial class Workflow1 : SequentialWorkflowActivity
{
private void codeActivity1_code(object sender, EventArgs e)
{
Console.WriteLine("Hi Vikas");
}
}
}






 OR



 

<SequentialWorkflowActivity x:Class="HelloWorldWF.Workflow1" x:Name="Workflow1" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow">
<CodeActivity x:Name="codeActivity1" ExecuteCode="codeActivity1_code" />
</SequentialWorkflowActivity>






The above workflow Workflow1 is a sequential type of workflow with only one activity called codeActivity1 which executes the method codeActivity1_code.



WF supports three kinds of authoring modes :





  1. Markup Only using XAML : where whole of the workflow definition is in the xaml file

  2. Markup + Code : where xaml contains the metadata of workflow and code contains the implementation

  3. Code Only : whole of the workflow is defined in code and is least flexible in nature


 



Other Posts



 


No comments:

Post a Comment