Using the Code Activity

The other activity we’ve used often so far in the book is the Code activity. The Code activity is meant to execute custom code you provide for execution within your workflow. There is a way to call external methods we’ll look at in the next chapter.

When you place a Code activity in your workflow, the ExecuteCode property should be set to the name of the method the workflow runtime will call.

Actually, if you look closely at the code Visual Studio inserted for you when you set the ExecuteCode property for the Sequencer application we just completed, it isn’t a method that’s called as much as it is an actual event handler. For example, here is the method we inserted for DoTaskOne:

private void DoTaskOne(object sender, EventArgs ...

Get Microsoft® Windows® Workflow Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.