240 likes | 438 Views
Windows Workflow Foundation. Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://mtaulty.com. EX: Check Inventory. EX: Escalate To Manager. Workflow Systems. Graphical Designer Component Palette Execution Engine Execution Services Extensibility.
E N D
Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://mtaulty.com
EX: Check Inventory EX: Escalate To Manager Workflow Systems Graphical Designer Component Palette Execution Engine Execution Services Extensibility Or a state diagram … Like a flowchart ...
Windows Workflow Foundation Single framework for building Workflow applications on Windows Programming model, runtime and tools Highly extensible Supports Human/System Workflow Supports long running Workflows and their state
Workflow Designer What Is Workflow Foundation?
IIS Windows Service Upload Service Admin Service Submitter Publisher Approver Workflow Scenario – Workflow Foundation
Workflow public class MyWorkflow { MyWorkflow() { Activities.Add(…); }} Activity Activity public class Activity { override Execute() { … } } public class Activity { override Execute() { … } } Workflows and Activities • A Workflow is a .NET class • Composed of Activity (.NET class) • Activities may be composed of more Activities • Built into an assembly and referenced like any other class
Basic Composite Base Activity Library
XAML XAML XAML Markup Only ‘Declarative’ Markup & Code Code Only Application Generated App. Creates ActivityTree & Serialises C#/VB C#/VB C#/VB XML defines workflowstructure logic and dataflow XML defines workflowCode-beside definesextra logic Code creates workflowin constructor Workflow Compiler wfc.exe .NET assembly ctor defines workflow Workflow Loader WorkflowRuntime C#/VB Compiler Workflow Authoring Modes
The Workflow Environment Demo WinFX Feb CTP
Workflow Designer Hosted in Visual Studio 2005 Hosted in your application for end-users Supports theming in both VS and non-VS environments
Hosting, Theming the Workflow Designer Demo WinFX Feb CTP
WF1 Instance MyWF.dll Sequence Apply Changes WF1 OnEvent1 Invoke1 Base Activity Library Runtime Engine Runtime Services Persistence Tracking Scheduling Transactions Workflow Runtime MyWorkflowHost.exe WorkflowRuntime rt = new WorkflowRuntime(); WorkflowInstance i = rt.CreateWorkflow(typeof(WF1)); i.Start();
Runtime Services Scenario WinFX Feb CTP
Make external call “GetTime” External Event “CoffeeTime” Begin Shared I/Face Workflow Instance class TimeService : ITimeService { GetTime(); event CoffeeTime(); } Coffee Time! ITimeService { GetTime(); event CoffeeTime();} Firing event involves knowing workflow id Add as service Runtime Services Runtime Engine Host/Runtime Communication MyWorkflowHost.exe
Host/Workflow Communication Scenario WinFX Feb CTP
FileCopyActivity class FileCopyActivity : Activity { override Execute();} Custom Activities • Activity is a class • Derive from an existing activity • Or Activity itself • Add properties • Dependency properties • Override Execute()
Companion Classes Designer Validator [Designer(typeof(MyDesigner))] [Validator(typeof(MyValidator))] [CodeGenerator(typeof(MyCodeGen))] [Serializer(typeof(MySerializer))] [ToolboxItem(typeof(MyToolboxItem))] Serialiser Code Generator ToolboxItem Activities: Optional Features Interface public class MyActivity: Activity { ... } ICompensatableActivity
Building Activities Scenario WinFX Feb CTP
Step1 Rule1 Event State1 Step1 Data State2 Event Step2 Rule2 Step2 Styles of Workflow Rules-driven Activities Sequential Workflow State Machine Workflow Sequential structure Prescribes processing order External events drive processing order Rules + data state drive processing order • Prescriptive, formal • Automation scenarios • Flowchart metaphor • Reactive, event-driven • Skip/re-work, exception handling • Graph metaphor • Data-driven • Simple conditions, complex policies • Constrained Activity Group
State Machine Workflows Demo WinFX Feb CTP
Change Applying Rule-based Policies Data Policy (RuleSet) Price: 200 Rule: If PRICE then Priority: 1 Rule: If … then Priority: 2 Rule: If … then Priority: 3 Rule: If … then Priority: 4 Rule: If … then Priority: 5
Rule-based Workflows & Policies Demo WinFX Feb CTP
Windows Workflow Foundation Resources • MSDN Workflow Page • Download 10 Hands-on Labs • http://msdn.microsoft.com/workflow • Community Site • Download samples, tools and runtime service components • http://www.WindowsWorkflow.net • Forums • http://www.WindowsWorkflow.net/Forums
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.