Download presentation
Presentation is loading. Please wait.
Published byGarry Miller Modified over 9 years ago
1
VWF310: Encapsulate Custom Business Processes with Custom WF Activities Brian Noyes IDesign Inc (www.idesign.net)www.idesign.net brian.noyes@idesign.net
2
About Brian Chief Architect, IDesign Inc. (www.idesign.net)www.idesign.net Microsoft Regional Director / MVP Publishing ● Developing Applications with Windows Workflow Foundation, LiveLessons training DVD, June 2007. ● Smart Client Deployment with ClickOnce, Addison Wesley, January 2007 ● Data Binding in Windows Forms 2.0, Addison Wesley, January 2006 ● MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side.NET, asp.netPRO, Visual Studio Magazine Speaking ● Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts Participates in Microsoft Design Reviews E-mail: brian.noyes@idesign.netbrian.noyes@idesign.net Blog: http://briannoyes.nethttp://briannoyes.net
3
Agenda Activities Overview Custom Activities Overview Custom Simple Activities Custom Composite Activities
4
WF Activities Overview Activities are the building blocks of workflows Activities can be simple or composite ● Simple: Does not contain child activities, just executable code ● Composite Contains child activities Can schedule children for proper execution order through the scheduler queue
5
Agenda Activities Overview Custom Activities Overview Custom Simple Activities Custom Composite Activities
6
Custom Activities Reasons for Custom Activities ● Encapsulation Composite activities to avoid duplication ● Domain specific activities Vertical market ● Advanced control flow Specific flow patterns Multithreading
7
Activities: An Extensible Approach l OOB activities, workflow types, base types l General-purpose l Activity libraries define workflow constructs l Create/Extend/ Compose activities l App-specific building blocks l First-class citizens Base Activity Library Custom Activity Libraries Author new activity Extend activity Compose activities Out-of-Box Activities l Vertical-specific activities & workflows l Best-practice IP & Knowledge Domain-Specific Workflow Packages Compliance RosettaNet CRM IT Mgmt
8
Custom Activities Author custom activity class (Required) ● Derives from Activity or other Base Activity Library class ● CompositeActivity for composites Define related classes (Optional) ● Executor ● Validator ● Designer ● Toolbox Item
9
Activity Attributes Designer ● Specify design time behavior of activity Validator ● Design and runtime checking to make sure activity is used correctly CodeGenerator ● Perform compile time code generation for the activity Serializer ● Serializes activity metadata to markup ToolboxItem ● Determine icon in Toolbox SupportsTransaction ● Enable transaction management and propagation in activity SupportsExceptionHandlers ● Allows hookup of exception handler activities
10
Activity Definition Base class : Activity Add 0..many DependencyProperty ● Centralized repository of workflow state ● Define the properties available on the activity ● Faster serialization than normal properties and fields ● Accessible from child activities Add 0..many wrapper (normal) properties ● Use base class GetValue/SetValue methods for persistence model ● Serializable types if persistence enabled
11
Activity Lifecycle InitializedExecutingClosed
12
Activity Lifecycle InitializedExecutingClosedUninitializing Canceling Faulting Compensatin g
13
Dependency Properties Three kinds ● Attached ● Data binding ● Metadata Add semantics over normal properties Greater scope than normal properties ● Stored through static state bag on base class
14
Agenda Activities Overview Custom Activities Overview Custom Simple Activities Custom Composite Activities
15
Simple Activity Definition Create class that inherits Activity base class Override base class Execute method Do activity work from Execute Can also override Initialize / Uninitialize Use activity execution context to access services
16
Agenda Activities Overview Custom Activities Overview Custom Simple Activities Custom Composite Activities
17
Composite Activity Types Basic ● Like a user control in Windows Forms or ASP.NET ● Container for other pre-defined activities ● Drag and drop in the designer ● Default rendering shows all child activities when used in a workflow ● Expose properties as needed Advanced ● Define custom child activity types or scheduling algorithms ● Define custom design time rendering and behavior
18
Advanced Composite Control Flow Enqueue child activities in desired order ● Use ActivityExecutionContextManager. CreateExecutionContext ● Use ActivityExecutionContext.ExecuteActivity ● Handle Closed event of child activities to decide on own composite activity completion
19
Resources Essential Windows Workflow Foundation, Dharma Shukla and Bob Schmidt, Addison Wesley Pro WF, Bruce Bukovics, Apress Microsoft Windows Workflow Foundation Step by Step, Kenn Scribner, Microsoft Press Build Custom Activities to Extend the Reach of Your Workflows, Matt Milner, MSDN Magazine, Dec 2006 http://msdn2.microsoft.com/en-us/magazine/cc163504.aspx http://msdn2.microsoft.com/en-us/magazine/cc163504.aspx Windows Workflow Foundation: Creating a Custom Composite Activity, Morgan Skinner, MSDN Online, http://msdn2.microsoft.com/en-us/library/aa480200.aspx http://msdn2.microsoft.com/en-us/library/aa480200.aspx Developing Applications with Windows Workflow Foundation, Brian Noyes, Addison Wesley LiveLesson Email: brian.noyes@idesign.netbrian.noyes@idesign.net Blog: http://www.softinsight.com/bnoyeshttp://www.softinsight.com/bnoyes
20
Your Feedback is Important Please fill out a session evaluation form and either put them in the basket near the exit or drop them off at the conference registration desk. Thank you!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.