Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WF4 : Custom activity with child activity

How can I create a custom activity for Workflow Foundation 4 that host a child activity (or several)?

The idea is to create something similar to the TryCatch activity where you can specify an activity that goes in the try part and another in the finally part. However I need my own custom business logic.

like image 581
olorin Avatar asked Oct 07 '10 16:10

olorin


1 Answers

Derive from NativeActivity. Use public properties to hold your children. Like

public Activity Body { get; set; }

override NativeActivityExecute(). Call NativeActivityContext.ScheduleActivity(this.Body). Use the overload that takes completion handlers - if you want some kind of sequential execution, that is, because scheduled activities are executed only after Execute() returns.

This is the basics.

like image 197
Tim Lovell-Smith Avatar answered Oct 06 '22 07:10

Tim Lovell-Smith