The Microsoft Technical Roadshow 2006 Windows Workflow Foundation Mike Taulty Developer & Platform Group Microsoft Ltd
EX: Check Inventory EX: Escalate To Manager Workflow Systems Graphical Designer Component Palette Execution Engine Execution Services Extensibility 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
WF != WWF
What Is Workflow Foundation? Workflow Designer
Scenario – Workflow Foundation Submitter IIS Upload Service Admin Service Windows Service Approver Publisher Workflow
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 Workflow public class MyWorkflow { MyWorkflow() { Activities.Add(…); } } Activity public class Activity { override Execute() { … } Activity public class Activity { override Execute() { … }
Base Activity Library BasicComposite
Workflow Authoring Modes C#/VB Compiler Markup Only Declarative XML defines workflow structure logic and data flow XAML Code Only Code creates workflow in constructor C#/VB Markup & Code XML defines workflow Code-beside defines extra logic XAMLC#/VB Application Generated XAML C#/VB App. Creates Activity Tree & Serialises Workflow Compiler wfc.exe.NET assembly ctor defines workflow Workflow Runtime Workflow Loader
The Workflow Environment Demo
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
Workflow Runtime Runtime Engine MyWF.dll WF1 MyWorkflowHost.exe WorkflowRuntime rt = new WorkflowRuntime(); Runtime Services PersistenceTrackingSchedulingTransactions Base Activity Library i.Start(); WorkflowInstance i = rt.CreateWorkflow(typeof(WF1)); WF1 Instance Sequence Invoke1 OnEvent1 Apply Changes
Runtime Services Scenario
Host/Runtime Communication Runtime Services Workflow Instance MyWorkflowHost.exe Runtime Engine class TimeService : ITimeService { GetTime(); event CoffeeTime(); } Make external call GetTimeExternal Event CoffeeTimeBegin Shared I/Face ITimeService { GetTime(); event CoffeeTime(); } Add as service Coffee Time! Firing event involves knowing workflow id
Host/Workflow Communication Scenario
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 ICompensatableActivity public class MyActivity: Activity {... } Interface Serialiser Designer ValidatorToolboxItem Code Generator Companion Classes [Designer(typeof(MyDesigner))] [Validator(typeof(MyValidator))] [CodeGenerator(typeof(MyCodeGen))] [Serializer(typeof(MySerializer))] [ToolboxItem(typeof(MyToolboxItem))]
Building Activities Scenario
Styles 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 State1 Event Rule1 Rule2 Data Step2 Step1
State Machine Workflows Demo
Applying Rule-based Policies Data Policy (RuleSet) Rule: If PRICE then Rule: If … then Priority: 1 Priority: 2 Priority: 3 Priority: 4 Priority: 5 Price: 200 Change
Rule-based Workflows & Policies Demo
Windows Workflow Foundation Resources MSDN Workflow Page Download 10 Hands-on Labs Community Site Download samples, tools and runtime service components Forums orums orums
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.