Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of...
-
Upload
beverley-sherman -
Category
Documents
-
view
220 -
download
0
description
Transcript of Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of...
![Page 1: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/1.jpg)
WINDOWS WORKFLOW
- AN INTRODUCTION
Mahesh Krishnan Senior Consultant, Readify
Slide 1
![Page 2: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/2.jpg)
Agenda
Introduction to Windows WorkflowWhat is it? What are activities?Hosting
Out of the box Activities Custom Activities and Dependency Properties Handling faults WF Persistence and Tracking
![Page 3: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/3.jpg)
Introduction to WF
Slide 3
![Page 4: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/4.jpg)
What is WF? Stands for Windows Workflow Foundation (not WWF) One of the 4 pillars of .NET 3.0 WF provides:
A programming model for building Application workflows A runtime to host them
![Page 5: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/5.jpg)
Windows Workflow Foundation
Two types of workflows:SequentialState machine
Visual Studio provides us the tooling support to create Workflows easily
Slide 5
![Page 6: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/6.jpg)
Activities Activities are building blocks of a WF To a workflow, an activity is a re-usable
program statement An activity that contains other activities
is called a Composite Activity Examples of out of the box activities:
SequenceActivityCodeActivityIfElseActivityWhileActivity
Slide 6
![Page 7: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/7.jpg)
WF Program A Workflow program is nothing but a
tree of activities WF programs typically wait for some
kind of an input and performs a bunch of activities
Once an activity finishes execution, the next activity in the WF is executed
Slide 7
![Page 8: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/8.jpg)
Creating workflows Can be created Declaratively (using
XAML) Imperatively via code
Slide 8
![Page 9: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/9.jpg)
Hosting The program is hosted via WorkflowRuntime
class Can be hosted in any .NET App
WinForms, Console, ASP.NET, WPF... Integrates with other MS technologies –
SharePointBizTalkWCF
Slide 9
![Page 10: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/10.jpg)
Simple Workflow Example (using Code
Activity)
Demonstration
Slide 10
![Page 11: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/11.jpg)
Things to cover IDE
Design surfaceProperties windowDocument Outline
Sample Workflow using Code activity Debugging experience
Slide 11
![Page 12: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/12.jpg)
Out of the box Activities
More on Activities
Slide 12
![Page 13: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/13.jpg)
Activities for Flow Control IfElseActivity WhileActivity ParallelActivity ConditionedActivityGroup (or CAG) Replicator TerminateActivity SuspendActivity InvokeWorkflowActivity
Slide 13
![Page 14: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/14.jpg)
Activities for State Management StateActivity SetStateActivity StateInitializationActivity StateFinalizationActivity
Slide 14
![Page 15: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/15.jpg)
Activites for Event Handling ListenActivity EventDrivenActivity EventHandlersActivity EventHandlingScopeActivity
Slide 15
![Page 16: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/16.jpg)
Out of the box Activities (contd) Heaps of others:
Activities for Calling web servicesTransaction handlingCompensationFault handlingSynchronizationCalling other workflowsetc
Slide 16
![Page 17: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/17.jpg)
Out of the box Activities
Demonstration
Slide 17
![Page 18: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/18.jpg)
Custom ActivitiesCreating your own activities
Slide 18
![Page 19: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/19.jpg)
Custom Activities Alternative to Code activity Derived from Activity class (or
something derived from it, like SequenceActivity)
Need to over ride Execute method Promotes re-use and is more testable Used from the designer Sometimes increases complexity
Slide 19
![Page 20: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/20.jpg)
Dependency Properties Properties in Custom activities are usually
implemented as Dependency Property Unlike normal properties, value is not stored
in an instance variable They are registered with Dependency
Property Framework and supports these scenarios:Activity BindingAttached propertiesMeta properties
Slide 20
![Page 21: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/21.jpg)
Dependency Property declaration
Slide 21
public static DependencyProperty CardNumberProperty = DependencyProperty.Register("CardNumber", typeof(string), typeof(ENettActivity));
[DescriptionAttribute(“The Credit Card number of user")][CategoryAttribute(“Credit Card Details")][BrowsableAttribute(true)][DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]public string CardNumber{
get { return ((string)(base.GetValue(ENettActivity.CardNumberProperty))); }set { base.SetValue(ENettActivity.CardNumberProperty, value); }
}
![Page 22: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/22.jpg)
Custom ActivityDemonstration
Slide 22
![Page 23: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/23.jpg)
Handling Faults
Slide 23
![Page 24: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/24.jpg)
Faults Faults can occur at any time in a WF:
Exceptions thrownActivity failuresThrow statements in code activitiesThrow Activity in WF
If a fault occurs and is not handled, then the WF terminates
Slide 24
![Page 25: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/25.jpg)
Fault handling try/catch blocks within code will work In custom activities, the HandleFault
method can be overridden to do clean ups
FaultHandlers and FaultHandler Activity can be used to handle specific Exceptions
Throw Activity can be used to throw Exceptions
Slide 25
![Page 26: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/26.jpg)
Handling FaultsDemonstration
Slide 26
![Page 27: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/27.jpg)
Workflow Persistence
Slide 27
![Page 28: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/28.jpg)
Why do you need it? Typically Workflows are long running You may want to maintain the state of
workflows between machine shutdowns You may want to unload workflow
(dehydration) that is idle Scalability and Resource consumption
Slide 28
![Page 29: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/29.jpg)
Persistence in Windows Workflow Implemented as an optional core service A Sql Server persistence service is
available out of the box The database can be created using
scripts from the directory - [...]\Framework\v3.0\Windows Workflow Foundation\SQL\en
The service can be added easily via configuration or via code
Slide 29
![Page 30: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/30.jpg)
Tracking Workflows
Slide 30
![Page 31: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/31.jpg)
Why do you need it? There may be lots of workflows running,
each in a different state You may want to track these workflows
and activities at runtime You may also want to find out what path
a certain Workflow instance took
Slide 31
![Page 32: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/32.jpg)
Tracking in Windows Workflow WF Tracking Framework allows
monitoring of workflows by capturing events raised during WF execution
SqlTracking service is used to write this to SQL Server database
Like the persistence service, this can be added easily via configuration or code
Slide 32
![Page 33: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/33.jpg)
Summary
Slide 33
![Page 34: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/34.jpg)
Summary Windows Workflow provides the runtime
and API to create workflows in .NET Activities are the building blocks of WF .NET provides a whole bunch of ready-
to-use activities, but custom activities can also be created
Persistence services are needed for long running workflows
Tracking services can also be added to track the running of workflows
Slide 34
![Page 35: Slide 1. Agenda Introduction to Windows Workflow What is it? What are activities? Hosting Out of the box Activities Custom Activities and Dependency.](https://reader036.fdocuments.us/reader036/viewer/2022062317/5a4d1af27f8b9ab05997f110/html5/thumbnails/35.jpg)
Questions?
Slide 35