1、Introduction to Windows Workflow Foundation (WF),Keith Elder Microsoft MVP Blog: http:/ Quicken Loans http:/,Agenda,Hello World in Workflow What is Workflow? Architecture Understanding the Runtime WF Extensibility Rules Engine Scenarios for WF Versioning Hosting WF in a SOA,DEMO HELLO WORLD,What is
2、Workflow?,http:/ workflow framework and tools for Microsoft products and partner/customer ecosystem,Single workflow technology for Microsoft WindowsA framework for building workflow, not an application or serverMake declarative workflow a mainstream development paradigmAt the end of the day workflow
3、 is a new namespace and supporting APIs developers can use to declaratively express business logic and long running processes.,http:/ Concepts,Visual Designer: Graphical and code-based construction,Workflows are a set of Activities,Workflows run within a Host Process: any application or server,Devel
4、opers can build their own Custom Activity Libraries,Components,Base Activity Library: Out-of-box activities and base for custom activities,Runtime Engine: Workflow execution and state management,Runtime Services: Hosting flexibility and communication,Understanding the Runtime,Host Application,App Do
5、main,SQL,Out of Box Services are provided that support SQL Server 2000 & 2005,Common resource services for managing threading, timers and creating transactions,PersistenceService stores and retrieves instance state.,TrackingService manages profiles and stores tracked information.,Runtime,Services,Pe
6、rsistenceService,TrackingService,SchedulerService,TransactionService,Services,http:/ An Extensible Approach,OOB activities, workflow types,base types General-purpose Activity librariesdefine workflowconstructs,Create/Extend/ Compose activities App-specific building blocks First-class citizens,Base A
7、ctivity Library,Custom Activity Libraries,Author new activity,Extend activity,Compose activities,Out-of-Box Activities,WF Extensibility Designer Rehosting,http:/ CUSTOM ACTIVITIES,Workflow Rules,Conditions on activities If-Else While Replicator Conditioned Activity Group (CAG)Policy activity Contain
8、s and executes a RuleSet RuleSet execution provides priority-based, forward-chaining semantics Rules can be used outside workflow,Forward Chaining,Amount = $25 Total = $80 Discount,= 10%,Rule 1 (P0) If Total $50 & = $100 Then Discount = 15% Rule 3 (P0) If Amount $0 Then Total = Total + Amount,Rule 1
9、 Rule 3 Rule 2,Execution Sequence,$105,RuleSet,15%,Policy Overview,Policy activity references a RuleSet in the workflow.rules file RuleSet class contains a collection of Rules Rules are If-Then-Else expressions that evaluate and operate on workflow members,CAG - Overview,Child activity executes When
10、(Condition1) CAG executes Until(Condition2) Default execution is a parallel When Executes activity once Until “All children quiescent” Executing children complete and all When conditions = false,Conceptually, an activity executes: IF When & !(Until),Child activities,DEMO RULES ENGINE,Versioning in W
11、F Where?,Workflow Activity Tracking Profile Rules Host and runtime services Exposed as a web service,Workflow Versioning,Compiled Standard .NET versioning story Strong Names, GAC, etc. What Im not going to dive into the details of Declarative This is what we call XAML-only workflows Versioning here
12、takes place in the host, when deciding what XAML to grabBut wait, my workflows are already running! DynamicUpdate API address how to change these,Scaling?,Cluster of Workflow Runtimes accessing the same persistence store,Workflow Runtime 1,Host* 1,SQL,SQL Persistence Service,Workflow Runtime 2,Host
13、2,SQL Persistence Service,Workflow Runtime 3,Host 3,SQL Persistence Service,Workflow Runtime N,Host N,SQL Persistence Service,* The host could be IIS,WF in a SOA,DEMO Calling Workflows via services,Introduction to Windows Workflow Foundation (WF),Keith Elder Microsoft MVP Blog: http:/ Quicken Loans http:/,