Transcript Slide 1
The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd [email protected] http://mtaulty.com Workflow Systems Graphical Designer Component Palette Execution Engine Execution Services Extensibility EX: Escalate To Manager EX: Check Inventory Like a flowchart ... Or a state diagram … 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 What Is Workflow Foundation? Workflow Designer Scenario – Workflow Foundation IIS Windows Service Upload Service Admin Service Workflow Submitter Approver Publisher Workflows and Activities Workflow Activity public class Activity { override Execute() {… } } public class MyWorkflow { MyWorkflow() { Activities.Add(…); } } Activity public class Activity { override Execute() {… } } 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 Base Activity Library Basic Composite Workflow Authoring Modes Markup Only ‘Declarative’ XAML XML defines workflow structure logic and data flow Markup & Code XAML C#/VB XML defines workflow Code-beside defines extra logic Application Generated C#/VB App. Creates Activity Tree & Serialises Code creates workflow in constructor XAML Workflow Compiler wfc.exe Workflow Loader Workflow Runtime Code Only .NET assembly ctor defines workflow C#/VB Compiler C#/VB Demo The Workflow Environment Workflow Designer Hosted in Visual Studio 2005 Hosted in your application for end-users Supports theming in both VS and non-VS environments Demo Hosting, Theming the Workflow Designer Workflow Runtime MyWorkflowHost.exe WorkflowRuntime rt = new WorkflowRuntime(); WorkflowInstance i = rt.CreateWorkflow(typeof(WF1)); i.Start(); WF1 Instance MyWF.dll Sequence WF1 OnEvent1 Invoke1 Apply Changes Base Activity Library Runtime Engine Runtime Services Persistence Tracking Scheduling Transactions Scenario Runtime Services Host/Runtime Communication MyWorkflowHost.exe Workflow Instance Shared I/Face class TimeService : ITimeService { Make Begin ITimeService { GetTime(); event CoffeeTime(); external call }“GetTime” GetTime(); Coffee event CoffeeTime(); } Time! External Event “CoffeeTime” Firing event involves Runtime Engine Runtime Services knowing workflow id Add as service Scenario Host/Workflow Communication Custom Activities Activity is a class Derive from an existing activity Or Activity itself Add properties Dependency properties Override Execute() FileCopyActivity class FileCopyActivity : Activity { override Execute(); } Activities: Optional Features Companion Classes Designer Validator [Designer(typeof(MyDesigner))] [Validator(typeof(MyValidator))] Serialiser [CodeGenerator(typeof(MyCodeGen))] Code Generator [Serializer(typeof(MySerializer))] ToolboxItem [ToolboxItem(typeof(MyToolboxItem))] Interface public class MyActivity: Activity { ... } ICompensatableActivity Scenario Building Activities Styles of Workflow Sequential Workflow State Machine Workflow Event Step1 Step2 Sequential structure Prescribes processing order • Prescriptive, formal • Automation scenarios • Flowchart metaphor State1 Rules-driven Activities Rule1 Step1 Data Event State2 External events drive processing order • Reactive, event-driven • Skip/re-work, exception handling • Graph metaphor Rule2 Step2 Rules + data state drive processing order • Data-driven • Simple conditions, complex policies • Constrained Activity Group Demo State Machine Workflows 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 Demo Rule-based Workflows & Policies 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/F orums © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.