Using a customized extension
WF4 also allows us to define our own WF4 extensions. In this task, we will create a simple extension and use this extension in a workflow.
How to do it...
Create a Workflow Console Application:
Add a new Workflow Console Application to the
Chapter06
solution and name itUsingCustomizedExtension
.Create a customized extension:
Add a new code file to the project and name the file
SimpleExtension.cs
. Fill the file with the following code:using System.Activities.Hosting; using System.Collections.Generic; using System; namespace UsingCustomizedExtension { public class SimpleExtension : IWorkflowInstanceExtension { private WorkflowInstanceProxy instance; public IEnumerable<object> GetAdditionalExtensions() { return null; } public void SetInstance(WorkflowInstanceProxy instance) { this.instance = instance; } public void DoSomething() { Console.WriteLine("Extension is doing something...