Presentation is loading. Please wait.

Presentation is loading. Please wait.

Extending Workflow With Custom Activities Dennis Pilarinos COM328 Program Manager Microsoft Corporation.

Similar presentations


Presentation on theme: "Extending Workflow With Custom Activities Dennis Pilarinos COM328 Program Manager Microsoft Corporation."— Presentation transcript:

1 Extending Workflow With Custom Activities Dennis Pilarinos COM328 dennispi@microsoft.com Program Manager Microsoft Corporation

2 PRESENTATION ASP.NET System.Web (2.0) Compilation Configuration Handlers Hosting Mail Management Security UI (2.0) Util Presentation Framework System.Windows (3.0) Annotations Automation Controls Data Documents Ink Interop Navigation Resources Serialization Shapes Threading System.Windows.Media (3.0) 3D Animation Imagine Windows Forms System.Windows.Forms (2.0) Design Layout VisualStyles Printing Subsystem System.Printing (3.0) GDI+ System.Drawing Design Drawing2D Printing ADO.NET System.Data Common Odbc OleDb OracleClient Sql SqlClient ASP.NET Data Management System.Web Caching Profile SessionState XML Data System.Xml Schema Serialization XPath Xsl Windows File System System.Storage (F) Core Audio Calendar Contacts Documents Image Media Messages Rules Sync Video XPS Documents System.Windows.Xps (3.0) System.IO.Packaging (3.0) Speech Integration System.Speech (3.0) Recognition Synthesis Language Integrated Query System.Query (F) System.Data.DLinq (F) System.Xml.XLinq (F) System.Expressions (F) Windows Communications Foundation System.ServiceModel (3.0) Channels Configuration Diagnostics Integration QueueHelper System.ServiceModel.Security(3.0) Protocols Tokens Network Class Library System.Net Cache Mail (2.0) Network Information (2.0) Security (2.0) Sockets.NET Remoting System.Runtime.Remoting ASMX Web Services System.Web.Services Identity Management Microsoft.InfoCards (3.0) MSMQ System.Messaging Directory Services System.DirectoryServices DATACOMMUNICATION FUNDAMENTALS BASE CLASS LIBRARIES System System.CodeDom System.ComponentModel System.Diagonostics System.IO (2.0) System.Resrouces System.Text System.ServiceProcess System.Threading System.Timers System.EnterpriseServices System.Transactions (2.0).NET Remoting System.Runtime.Remoting System.Text Generic (2.0) System.Reflection Email System.Configuration System.Text AccessControl (2.0) Cryptography (2.0) Permissions Policy Principal (2.0) Managed Add-In Framework System.Addins (F) Contact Microsoft.Build (2.0) System.Runtime CompilerServices ConstrainedExecution (2.0) InteropServices Hosting Serialization Versioning “ClickOnce” Deployment System.Deployoment (2.0) WINDOWS VISTA (2.0) (3.0)- New (2.0)- Substantially Improved - Windows Presentation Foundation (formerly codenamed “Avalon”) - Windows Communication Foundation (formerly codenamed “Indigo”) - Windows Workflow Foundation KEY Windows Workflow Foundation System.Workflow (3.0) System.Workflow.Activities (3.0) Rules System.Workflow.ComponentModel (3.0) Compiler Designer Serialization System.Workflow.Runtime (3.0) Hosting Messaging

3 Windows Workflow Foundation Single workflow technology for Microsoft products, partners and customers A framework to build on – not a server or application Key features Enables long running workflows in any application or server Extensible activity framework Unified model for human and system workflow scenarios Visual designer for graphical and code-based authoring Availability Availability Exposed via WinFX – powers Office “12” workflow Extensible framework and tools for building workflow into Windows applications

4 Windows Workflow Foundation Key Concepts Host Process Windows Workflow Foundation Runtime Engine A Workflow An Activity Runtime Services Base Activity Library Custom Activity Library Visual Designer Visual Designer: Graphical and code- based construction Workflows are a set of Activities Workflows run within a Host Process: any application or server Developers 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

5 This Session Extending Workflow Capabilities With Custom Activities (COM328) Wed 3:15 – 150/151 Hall E Developing Rules-Driven Workflows (COM318) Wed 5:00 – 152/153 Hall F Developing Event-Driven State Machine Workflows (COM322) Thurs 2:15 – 515 AB Hosting and Communications in Workflow Scenarios (COM327) Thurs 5:15 – 402 AB Workflow + Messaging + Services - Developing Dist’d Apps (COM325) Thurs 3:45 – 150/151 Hall E Host Process Windows Workflow Foundation Runtime Engine Runtime Services Base Activity Library My Custom Activity Library State Machine Workflows Rules-Driven Activities Communication Activities My Workflows Introduction to Workflow in Windows Applications (COM210) Wed 1:45 – 150/151 Hall E Windows SharePoint Services: Developing Custom Workflows (OFF415) Thurs 11:30 – 408 AB

6 Activities Activities allow you to model an application semantics in an explicit way Activities all the way down! Basic – opaque/leaf nodes of a program tree Composite – transparent/modeling constructs/containers for other activities Root – a special composite that is a unit of activation

7 When do you write custom activities? Out of the box Activities get you started… Write custom activities for modeling advanced control flows modeling various workflow styles integrating with technologies aligning with standards Out of the box activities built using the same framework that’s available to you as developers

8 Building a Basic Activity

9 Activity Component Model Required Optional (defaults provided) Each activity has an associated set of components Components are associated through attributes on the Activity Definition [Designer(typeof(MyDesigner))] [CodeGenerator(typeof(MyCodeGen))] [Validator(typeof(MyValidator))] public class MyActivity: Activity {...} Activity Code Generator Designer Validator Serializer Services

10 Activity Designer & Validator Components

11 Activity Execution Transition Types Activity Execution Methods Initialize()Execute()Cancel()Compensate() Activity Runtime InitializedExecutingClosed Canceled Compensating

12 Typical Composite Activity Execution Composite Activity.. += OnChildClosed Execute() Status.Closed() ChildActivity ChildActivity

13 Sequence Activity – Execute() protected override Status Execute(ActivityExecutionContext context) { Activity childActivity = this.ExecutableActivities[0]; EventHandler OnClosed = null; OnClosed = delegate { childActivity.Closed -= OnClosed; if (this.Status == Status.Canceling) context.CloseActivity(); context.CloseActivity(); else if (this.Status == Status.Executing) { this.index++; this.index++; if (this.ExecutableActivities.Count > this.index) if (this.ExecutableActivities.Count > this.index) { childActivity = this.ExecutableActivities[this.index]; childActivity = this.ExecutableActivities[this.index]; childActivity.Closed += OnClosed; childActivity.Closed += OnClosed; context.ExecuteActivity(childActivity ); context.ExecuteActivity(childActivity ); } } else else context.CloseActivity(); context.CloseActivity();}}; childActivity.Closed += OnClosed; context.ExecuteActivity(childActivity); return Status.Executing; }

14 Advanced Composite Activity Execution Activities may need to spawn persistable execution environments as a part of their execution This opens up interesting possibilities of modeling advanced control flows Loops, Continuations, Dynamic Activities etc.

15 ForEach Activity Execution Contexts Template Activity Context Owner Activities Children Contexts of ForEach activity Context 1 Context 2 Context 3 Default Workflow Context

16 ForEach activity

17 Activity Composition Patterns Three Activity Reuse Models White Box Children activities visible and structure editable Grey Box Children activities visible but structure not editable Black Box Children activities completely hidden to workflow author Controlled via Editable & Visible attributes on each child activity BlackGreyWhite EditableFalseFalseTrue VisibleFalseTrueTrue

18 Property Promotion Enables the composition patterns Children at any depth can have their properties exposed the composite activity Allows the workflow author / activity consumer to configure values which affect internal activity logic without exposing logic Supported through the Custom Activity Designer

19 Custom Activity Designer

20 Summary An Activity is a key concept of WWF WWF allows you to write custom activities to model your application semantics explicitly System.Workflow.ComponentModel provides the framework to build custom activities Call to action: Write Activities!

21 Workflow Sessions Extending Workflow Capabilities With Custom Activities (COM328) Wed 3:15 – 150/151 Hall E Developing Rules-Driven Workflows (COM318) Wed 5:00 – 152/153 Hall F Developing Event-Driven State Machine Workflows (COM322) Thurs 2:15 – 515 AB Hosting and Communications in Workflow Scenarios (COM327) Thurs 5:15 – 402 AB Workflow + Messaging + Services - Developing Dist’d Apps (COM325) Thurs 3:45 – 150/151 Hall E Host Process Windows Workflow Foundation Runtime Engine Runtime Services Base Activity Library My Custom Activity Library State Machine Workflows Rules-Driven Activities Communication Activities My Workflows Introduction to Workflow in Windows Applications (COM210) Wed 1:45 – 150/151 Hall E Windows Communication Foundation Windows SharePoint Services: Developing Custom Workflows (OFF415) Thurs 11:30 – 408 AB

22 More Community Resources At PDC 12 Labs: COMHOL01-12 “Ask The Experts” tables – 4 tables and lots of experts COM Track Lounge Get your copy of the “Introducing Windows Workflow Foundation” book Keep your voucher from the Day2 morning keynote and redeem at the PDC bookstore After PDC If you missed this related session, watch it on the DVD MSDN dev center: http://msdn.microsoft.com/workflow/ http://msdn.microsoft.com/workflow/ Windows Workflow Foundation community site http://www.windowsworkflow.net http://www.windowsworkflow.net Channel 9 tag: http://channel9.msdn.com/tags/workflow

23 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Extending Workflow With Custom Activities Dennis Pilarinos COM328 Program Manager Microsoft Corporation."

Similar presentations


Ads by Google