introducing windows workflow foundation. understanding windows workflow foundation janakiram msv...
Post on 22-Dec-2015
234 views
TRANSCRIPT
Understanding Windows Workflow Foundation
Janakiram MSV
Developer Evangelist
Microsoft Corporation
Introducing Windows Workflow Foundation
• WPF-Windows Presentation Foundation– XAML– XAMLPad, Expression Editor, VS Designer
• CardSpace• WCF-Windows Communication Foundation• WF-Workflow Foundation• Orcas
– .NET 3.0 Visual Studio Extensions
.Net Framework 3.0
Flowchart Scenarios
• Document Life Cycle Management
• LOB Application Workflow
• Business Process Management
• UI Navigation Logic
public void PlaceNewOrder(Employee e, Product p){ if(e.FTE) switch(p.Category) {
case “Computer”: if (GetManagerApproval(e,p)) {
Inventory i=InventoryServiceProxy.GetInventory(P.ProductID);if(i.InStock){ PurchaseOrder PO=new PurchaseOrder(p,1); OrderAck Ack=OrderServiceProxy.SendPO(PO); SendMail(
“Placed New Order”, ”Order #” + Ack.OrderNo+” Expected on ”+ ACK.ShipDate, e.EmailID );}
}……………………………………………….……………………………………………….
}
Yet Another Component….
Today’s Application Development
FormsForms
DataData
ApplicationApplicationlogiclogic
Rules andRules andpoliciespolicies
ApplicationApplicationcodecode
Workflow Workflow modelmodel
ServiceServicess
What is Workflow?
• Dictionary.com Definition– The flow or progress of work done by a
company, industry, department, or person. – The rate at which such flow or progress takes
place
Tenets of Workflow
Workflows coordinate work performed by people and by software
Workflows are long running and stateful
Workflows are transparent and dynamic through their lifecycle
Workflows are based on extensible models
Introducing Windows Workflow Foundation
• Provide a singular engine for workflow execution for all applications built on the Windows platform
• Supports a wide range of scenarios
• Bring model-driven workflow development to the entire .NET development community
• Enable reusable workflow component development to ensure both developers and ISVs can deeply embed this technology in their applications.
Windows Workflow Foundation
Key Concepts
Host Process
WindowsWorkflow Foundation
Runtime Engine
A Workflow
An Activity
Runtime Services
Base Activity Library
Custom Activity Library
Visual Designer
• Visual Designer: Graphical and code-based construction
• Workflows are a set of Activities
• Workflows run within a Host Process: any application or server
• Developers can build their own Custom Activity Libraries
Components
• Base Activity Library: Out-of-box activities and base for custom activities
• Runtime Engine: Workflow execution and state management
• Runtime Services: Hosting flexibility and communication
Workflow Basics
• A workflow is a class
• A workflow class may be defined in markup
<?Mapping XmlNamespace="Activities" ClrNamespace="System.Workflow.Activities" Assembly="System.Workflow.Activities" ?>
<SequentialWorkflow x:Class="MyWorkflow" xmlns="Activities" xmlns:x="Definition"> …</SequentialWorkflow>
using System.Workflow.Activities;
public class Workflow1 : SequentialWorkflow{}
Workflow Basics
• Workflow constructor configures contained activities (like forms & controls)
using System.Workflow.Activities;public partial class Workflow1 : SequentialWorkflow {
public Workflow1() {
InitializeComponent();}
}
public sealed partial class Workflow1 : SequentialWorkflow {private Delay delay1;private void InitializeComponent()
{this.delay1 = new System.Workflow.Activities.Delay();this.delay1.ID = “delay1";this.delay1.TimeoutDuration =
System.TimeSpan.Parse("00:00:05");this.Activities.Add(this.delay1);this.ID = "Workflow1";
}}
What are Activities?
• An activity is a step in a workflow– Has properties and events that are
programmable within your workflow code– Has methods (e.g. Execute) that are only
invoked by the workflow runtime
• Think of Forms & Controls– Activity == Controls– Workflows == Forms
• Activities fall under two broad categories– Basic – steps that “do work”– Composite – manage a set of child activities
Activities: An Extensible Approach
– OOB activities,workflow types,base types
– General-purpose– Activity libraries define workflow
constructs
– Create/Extend/Compose activities
– App-specificbuilding blocks
– First-class citizens
Base Activity
Library
Custom ActivityLibraries
Author new activity
Base ActivityLibrary
Extend activity
Compose activities
– Vertical-specificactivities & workflows
– Best-practice IP &Knowledge
Domain-SpecificWorkflow Packages
Compliance
RosettaNet
CRM
IT Mgmt
Flexible Control Flow
Rules-driven Activities
Step2
Step1Rule1Rule1
Rule2Rule2
DataRules + data statedrive processing order
•Data-driven•Simple Conditions, complex Policies •Constrained Activity Group
State Machine Workflow
State2
State1EventEvent
EventEvent
External events drive processingorder
•Reactive, event-driven•Skip/re-work, exception handling•Graph metaphor
Sequential WorkflowStep1
Step2
Sequentialstructure prescribesprocessing order
•Prescriptive, formal•Automation scenarios•Flowchart metaphor
Summary
• A single workflow technology for Windows– Platform level workflow framework for use within Microsoft products & ISV
applications– Will be used by BizTalk Server, Office 2007 MBS & other Microsoft client/server
products– Available to all Windows customers
• Microsoft is redefining workflow– Unified technology for System & Human workflow– Multiple styles: sequential, rules-based, state machine– Supports dynamic interaction
• Microsoft is taking workflow mainstream– Consistent and familiar programming model for reaching mainstream application
developer– Available to millions of end-users through Office 2007– Extensible platform for ISVs
Resources
• http://wf.netfx3.com
• http://msdn.microsoft.com/winfx
• http://www.microsoft.com/seminar