the microsoft technical roadshow 2006 windows workflow foundation mike taulty developer &...

24
The Microsoft Technical Roadshow 2006 Windows Workflow Windows Workflow Foundation Foundation Mike Taulty Mike Taulty Developer & Platform Group Developer & Platform Group Microsoft Ltd Microsoft Ltd [email protected] [email protected] http://mtaulty.com http://mtaulty.com

Upload: carlos-waddell

Post on 26-Mar-2015

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

The Microsoft

Technical Roadshow 2006

Windows Workflow FoundationWindows Workflow FoundationMike TaultyMike Taulty

Developer & Platform GroupDeveloper & Platform Group

Microsoft LtdMicrosoft Ltd

[email protected]@microsoft.com

http://mtaulty.comhttp://mtaulty.com

Page 2: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

EX: Check InventoryEX: Escalate To Manager

Workflow SystemsWorkflow Systems

Graphical DesignerGraphical DesignerComponent PaletteComponent PaletteExecution EngineExecution Engine

Execution ServicesExecution ServicesExtensibilityExtensibility

Like a flowchart ... Like a flowchart ... Or a state diagram … Or a state diagram …

Page 3: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Windows Workflow FoundationWindows Workflow Foundation

Single Single frameworkframework for building for building Workflow applications on WindowsWorkflow applications on Windows

Programming model, runtime and Programming model, runtime and toolstools

Highly extensibleHighly extensible

Supports Human/System WorkflowSupports Human/System Workflow

Supports long running Workflows Supports long running Workflows and their stateand their state

Page 4: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

What Is Workflow Foundation?What Is Workflow Foundation?

Workflow Designer

Page 5: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Scenario – Workflow FoundationScenario – Workflow Foundation

Submitter

IIS

Upload ServiceAdmin Service

Windows Service

Approver

Publisher

Workflow

Page 6: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Workflows and ActivitiesWorkflows and Activities

A Workflow is a .NET classA Workflow is a .NET class

Composed of Composed of ActivityActivity (.NET class) (.NET class)

ActivitiesActivities may be composed of more may be composed of more ActivitiesActivities

Built into an assembly and referenced like any other classBuilt into an assembly and referenced like any other class

Workflow

public class MyWorkflow{ MyWorkflow() { Activities.Add(…); }}

Activity

public class Activity{ override Execute() { … }}

Activity

public class Activity{ override Execute() { … }}

Page 7: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Base Activity LibraryBase Activity Library

Basic Composite

Page 8: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Workflow Authoring ModesWorkflow Authoring Modes

C#/VB Compiler

Markup Only‘Declarative’

XML defines workflowstructure logic and dataflow

XAML

Code Only

Code creates workflowin constructor

C#/VB

Markup & Code

XML defines workflowCode-beside definesextra logic

XAML C#/VB

ApplicationGenerated

XAML C#/VB

App. Creates ActivityTree & Serialises

Workflow Compilerwfc.exe

.NET assembly ctor defines

workflow

WorkflowRuntime

Workflow Loader

Page 9: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

The Workflow EnvironmentThe Workflow Environment

DemoDemo

Page 10: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Workflow DesignerWorkflow Designer

Hosted in Visual Studio 2005Hosted in Visual Studio 2005

Hosted in your application for end-usersHosted in your application for end-users

Supports theming in both VS and non-VS Supports theming in both VS and non-VS environmentsenvironments

Page 11: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Hosting, Theming the Workflow Hosting, Theming the Workflow DesignerDesigner

DemoDemo

Page 12: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Workflow RuntimeWorkflow Runtime

Runtime Engine

MyWF.dll

WF1

MyWorkflowHost.exeWorkflowRuntime rt = new WorkflowRuntime();

Runtime Services

Persistence Tracking Scheduling Transactions

Base Activity Library

i.Start();

WorkflowInstance i = rt.CreateWorkflow(typeof(WF1));

WF1 Instance

Sequence

Invoke1OnEvent1 Apply

Changes

Page 13: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Runtime ServicesRuntime Services

ScenarioScenario

Page 14: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Host/Runtime CommunicationHost/Runtime Communication

Runtime Services

Workflow Instance

MyWorkflowHost.exe

Runtime Engine

class TimeService : ITimeService

{

GetTime();

event CoffeeTime();

}Make external call “GetTime”

External Event “CoffeeTime”

Begin

Shared I/Face

ITimeService{ GetTime(); event CoffeeTime();}

Add as service

Coffee

Time!

Firing event involves

knowing workflow id

Page 15: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Host/Workflow CommunicationHost/Workflow Communication

ScenarioScenario

Page 16: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Custom ActivitiesCustom Activities

Activity is a classActivity is a class

Derive from an existing Derive from an existing activityactivity

Or Or ActivityActivity itself itself

Add propertiesAdd properties

Dependency Dependency propertiesproperties

Override Override Execute()Execute()

FileCopyActivity

class FileCopyActivity : Activity{ override Execute();}

Page 17: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Activities: Optional FeaturesActivities: Optional Features

ICompensatableActivitypublic class MyActivity: Activity{ ...

}

Interface

Serialiser

Designer

Validator

ToolboxItem

Code Generator

Companion Classes

[Designer(typeof(MyDesigner))]

[Validator(typeof(MyValidator))]

[CodeGenerator(typeof(MyCodeGen))]

[Serializer(typeof(MySerializer))]

[ToolboxItem(typeof(MyToolboxItem))]

Page 18: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Building ActivitiesBuilding Activities

ScenarioScenario

Page 19: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Styles of WorkflowStyles of Workflow

Rules + data state drive processing order

Rules-driven Activities

• Data-driven• Simple conditions,

complex policies • Constrained Activity

Group

State Machine Workflow

External events drive processing order

• Reactive, event-driven• Skip/re-work,

exception handling• Graph metaphor

Sequential Workflow

Sequential structure Prescribes processing order

• Prescriptive, formal• Automation scenarios• Flowchart metaphor

Step1

Step2

State2

State1Event

Event

Rule1

Rule2

Data

Step2

Step1

Page 20: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

State Machine WorkflowsState Machine Workflows

DemoDemo

Page 21: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Applying Rule-based PoliciesApplying Rule-based Policies

Data

Policy (RuleSet)

Rule: If PRICE then

Rule: If … then

Rule: If … then

Rule: If … then

Rule: If … then

Priority: 1

Priority: 2

Priority: 3

Priority: 4

Priority: 5

Price: 200

Change

Page 22: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Rule-based Workflows & PoliciesRule-based Workflows & Policies

DemoDemo

Page 23: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Windows Workflow Foundation Windows Workflow Foundation ResourcesResources

MSDN Workflow PageMSDN Workflow Page

Download 10 Hands-on LabsDownload 10 Hands-on Labs

http:http://msdn//msdn..microsoftmicrosoft.com/workflow.com/workflow

Community SiteCommunity Site

Download samples, tools and Download samples, tools and runtime service componentsruntime service components

http://www.http://www.WindowsWorkflowWindowsWorkflow.net.net

ForumsForums

http://www.http://www.WindowsWorkflowWindowsWorkflow.net/Forums.net/Forums

Page 24: The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.