views:

26

answers:

1

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.

+1  A: 

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.

Tim Lovell-Smith
Thanks for your answer, I missed the inheritance from native activity.
olorin