Mohammed Atef’s Technical blog

Workflow Foundation 4.0

The new Workflow foundation comes with .Net Framework 4.0 that supports building and running the next generation of applications and services. The key components of the .NET Framework are the common language runtime (CLR) and the .NET Framework class library, which includes ADO.NET, ASP.NET, Windows Forms, and Windows Presentation Foundation (WPF), by the way all Visual Studio 2010 IDE are build in XAML language that provides a managed execution environment, simplified development and deployment, and integration with a wide variety of programming languages.

In version 4 of the Microsoft® .NET Framework, Windows Workflow Foundation introduces a significant amount of change from the previous versions of the technology that shipped as part of .NET 3.0 and 3.5.

The significant changes made were necessary to provide the best experience for developers adopting WF and to enable WF to continue to be a strong foundational component that you can build on in your applications.

I have wrote this article to give you a start point to understand and study Workflow Foundation 4.0, so I am going to write series of posts about WFF 4.0 as found in the below below List

I hope that helped

September 20, 2010 Posted by | .Net 2010 | , , , , , | 6 Comments

What’s new in Workflow Foundation 4.0

The New Workflow Foundation 4.0 introduces a significant amount of change from the previous versions of the technology that shipped as part of .NET 3.0 and 3.5. so let’s go quickly to see these new features

  • Designers are built in XAML The designer is based on Windows Presentation Foundation (WPF),so it is taking full advantage of the rich user experience one can build with the declarative UI framework.  Activity developers will use XAML to define the way their activities look and interact with users in a visual design environment.  In addition, it enables non-developers to view and interact with your workflows is now much easier as XAML language is written in XML language that give any non-developers ability to read and understand it.

    For example if you have created new project of Console Workflow and dragged a WriteLine activity in the designer and select the code view you will find the following list of XAML codes

       1: <Activity mc:Ignorable="sap" x:Class="WorkflowConsoleApplication1.Workflow1" sap:VirtualizedContainerService.HintSize="251,240" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
       2: <WriteLine
       3: sad:XamlDebuggerXmlReader.FileName="C:\Temp\DotNet4\WorkflowConsoleApplication1\Workflow1.xaml"
       4: sap:VirtualizedContainerService.HintSize="211,200" />
       5: </Activity>

    I think any non-developer can understand the above list of XAML code

  • Different project templates The new Workflow Foundation 4.0 comes with new project templates as shown in below pictureclip_image002

    The above picture shows only four project templates of Workflow Foundation 4.0 that leads you to simplify project templates for developer. The first project template Activity Designer Library let you create you custom Workflow Foundation Activity with designer, while the second project template leads you to create your custom activity by inheriting the CodeActivity class and the third project template leads you to build new WCF Workflow Service and we are going to explain this project template deeply in another post later finally the last project type help you for creating Console application that contain Workflow Activities.

    If you reviews the below pictures that has list of project template found for Workflow Foundation 3.5 you will understand that new Workflow Foundation 4.0 has summarized and compressed the project templates in better way.

    clip_image002[7]

  • Variable and parameters new windows in the WFF IDE Workflow Foundation 4.0 introduces a helpful window for creating variables and parameters to your Workflow in easy way, the below two pictures show you the new windows generated for defining variables and parameters

    clip_image002[9]

    clip_image002[11]

    First Picture show you how to declare variable to you workflow, as shown there you can define the DataType of you variable, default value and the scope of a variable either the entire workflow or just a specific activity or its children.

    Second picture show you how to define arguments by specifying its name, direction(In,Out,In/Out), argument type and default value.

    If you have used Workflow Foundation 3.5 before you should understand what Workflow Foundation 4.0 has introduced to you for declaring variables and arguments as in WFF 3.5 you should write the following list of codes to define variable

   1: public static DependencyProperty MessageProperty =
   2:     DependencyProperty.Register("Message", typeof(string), typeof(CustomActivity));
   3:
   4:         [DescriptionAttribute("Message")]
   5:         [BrowsableAttribute(true)]
   6:         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
   7:         public string Message
   8:         {
   9:             get
  10:             {
  11:                 return ((string)(base.GetValue(MessageProperty)));
  12:             }
  13:             set
  14:             {
  15:                 base.SetValue(MessageProperty, value);
  16:             }
  17:         }
  18:

The above bulk of code writes only for defining variable Named message of type string

  • Windows Communication Foundation (WCF) Integration

    Workflow Foundation 4.0 introduce creating services and consuming or coordinating service interactions.  A great deal of effort went into enhancing the integration between WCF and WF.  New messaging activities, message correlation, and improved hosting support, along with fully declarative service definition are the major areas of improvement, We will go deeply throw WCF integration with the new WF in another post later.

  • New built in Activity The new Workflow Foundation 4.0 has a lot of built in activities as follows- New activities for manipulating data such as Assign and collection activities such as AddToCollection.

    - New flow control activities, such as DoWhile, TryCatch, ForEach, Switch, and ParallelForEach.

    - Activities for controlling transactions, such as TransactionScope and Compensate.

    - New messaging activities such as SendContent and ReceiveReply.

    Most of these Activities will be explained in the next post for WFF 4.0 toolbar.

    Back to other Workflow Foundation 4.0  posts

I Hope that Helped

September 20, 2010 Posted by | .Net 2010 | , , , , , | 1 Comment

   

Follow

Get every new post delivered to your Inbox.