the microsoft technical roadshow 2006 windows workflow foundation mike taulty developer &...
TRANSCRIPT
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
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 …
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
What Is Workflow Foundation?What Is Workflow Foundation?
Workflow Designer
Scenario – Workflow FoundationScenario – Workflow Foundation
Submitter
IIS
Upload ServiceAdmin Service
Windows Service
Approver
Publisher
Workflow
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() { … }}
Base Activity LibraryBase Activity Library
Basic Composite
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
The Workflow EnvironmentThe Workflow Environment
DemoDemo
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
Hosting, Theming the Workflow Hosting, Theming the Workflow DesignerDesigner
DemoDemo
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
Runtime ServicesRuntime Services
ScenarioScenario
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
Host/Workflow CommunicationHost/Workflow Communication
ScenarioScenario
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();}
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))]
Building ActivitiesBuilding Activities
ScenarioScenario
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
State Machine WorkflowsState Machine Workflows
DemoDemo
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
Rule-based Workflows & PoliciesRule-based Workflows & Policies
DemoDemo
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
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.