index > Windows Workflow Foundation > How to cancel a sequential workflow with cleanup in advance

How to cancel a sequential workflow with cleanup in advance

Hello,

I want to cancel a sequential workflow, but doing some cleanup in advance.

  1. The terminateActivity just aborts the workflow and I 'll have to do some cleaning just before getting to the terminateactivity all the time(because it does not go into faulthandler or cancellation handler). But the cleanup procedure is always the same. Furthermore I have to do this very often in serveral branches in the workflow erverytime I want to abort the workflow, so this is no solution.

  2. If I raise an exception somewhere in the workflow I 'll get to the FaultHandler. The activities in there are then being executed and then the workflow continues. But it has to be aborted! So I could throw some exception again inside the faulthandler...ugly!

  3. But I need something(activity) which goes into the faulthandler, cancellationhandler(or something else whatsoever) does some cleanup and then terminates the workflow(or the workflow terminates itself then).

How can I achieve that! Is there probably some way I could use(misuse?) the cancellation handler for that?
Any hints are welcome!

Thanks a lot

David
Urpcor

Create a composite activity that either

a) defines your cleanup code statically, or with some properties settable by the consumer, and then ends with a terminate shape built right in.

b) allows the user to add any thing they want to it (basic derivation from a sequence) and then add the terminate in behind the scenes using a toolboxitem perhaps.

Matt




See What You Can Learn -- http://www.pluralsight.com/courses/IntroducingWF.aspx
Matt Milner - Pluralsight
Hi !

Thanks a lot.
I found that Create a composite activity is a bit too complex if I want to use and configure it in the Workflowdesigner.

So i put a terminate activity at the end of the FaultHAndler.
If an errror occurs then I throw some Exception which when is leads to the fault handler and does the cleanup and then TErminate itselfs.

Workflowfoundation is cool!

Thanks again
David
Urpcor
reply 3

You can use google to search for other answers

 

More Articles

• CodeDomDesignerLoaderNoRootSerializer appears
• Serious design flaw in HandleExternalEventActivity?
• Creating custom activities that are correlated to other activitie...
• Workflow with ASP.NET application
• Workflow designer ignores DefaultValueAttribute?
• WorkflowQueuingService
• HandleExternalEvent Problem
• State machines inside sequential workflow
• How do you store and retrieve rules and xoml xml in SQL Server 20...
• Subscription service and persistence service
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• workflow versioning question
• IfElse Activity in a While Activity
• HUman Interaction Sample
• Windows workflow in ASP.Net
• Any New ASP.NET/WF Functionality for Tec
• Page_Unload Event Handler Question
• CallExternalMethodActivty with Input Par
• ExternalDataExchangeService API usage is
• Task List presentation of "my assig
• Expense Reporting Sample using Webservices
• Cleaning Persisted Workflows
• persistence problem after host applicati
• Multiple Recursive composition
• "WORKFLOW FAILED VALIDATION ERROR&q
• custom EventDrivenActivity? custom Repli

Hot Articles

• Beta2 Installation problems
• which one to use... having trouble getti
• Files saved to a CD unable to open
• Editing XOML in VS2005 and other designe
• Workflow Serialization
• Issue on loading & resuming an unloa
• Print WWF documentation
• The sample of Beta1 can't run on Beta2 r
• The service 'System.Workflow.ComponentMo
• Dynamic update to ASP.NET hosted workflow
• wf.Parameters
• WF RTM and .NET Framework 3.0
• How to reference to System.Workflow.Runt
• Performance difference when using the Cr
• !!Custom Sequential activity never chang

Recommend Articles

• How can an activity close itself?
• BUG:Persistance Fails when using a Track
• TypeProvider in Designer Hosting SDK Sam
• The process cannot access the file becau
• Workflow management in Enterprise Enviro
• Is there a control for the Designer and
• SharePoint Worflow project template
• Activites in different process
• Windows Worflow Designer
• Custom Activity Approach
• The workflow hosting environment does no
• Stepping around in a workflow and buildi
• Scalability for Hosting Multiple Instanc
• How to communicate between Parent childs
• Serious design flaw in HandleExternalEve