How to Generate Strictly Bound Activities for Host Methods?
WF enables you to generate strictly bound activities to interact with methods on the host process in the same way that you create strictly bound controls. Strictly bound activities enable you to add activities to your workflow that are already configured to a specific host process event. You do not need to specify the InterfaceType or MethodName properties; these are built into the activity and hidden from view so that they cannot be changed. The strictly bound activity is effectively a CallExternalMethodActivity activity that is bound to a single method on a single interface, which you can drag onto your workflow with no further configuration required.
The process that is used to create strictly bound activities is defined below.
Step 1: Define the service interface
To enable the wca.exe activity to extract information about the method that is called by the new activity, you must specify an interface with the method definition. Remember that any interface to be used in this way requires the ExternalDataExchange attribute.
The service class requires an implementation so that the method itself will be raised. You can implement the interface at any time; it is not required for activity generation.
Important: You must build the assembly before using the wca.exe tool. If you do not build the assembly, the interface is not compiled and the tool cannot examine it to retrieve method information.
Step 2: Run the wca.exe tool
Use the Visual Studio 2008 Command Prompt to run the wca.exe tool and specify the assembly to examine by using a parameter to the program call.
The wca.exe tool will output two files: assemblyname.invokes.languageand assemblyname.sinks.language. The assemblyname.invokes.languagefile contains strictly bound CallExternalMethodActivity activities and the assemblyname.sinks.languagefile contains strictly-bound HandleExternalEventActivity activities.
Step 3: Add the generated files to your workflow solution
You can add the generated files to your workflow project directly or to a project that is referenced by the workflow.
To add the files, right-click the project node, point to Add, click Existing Item, use the Add Existing Item dialog box to locate and select the items to add, and then click Add.
Tip: You can add multiple items to a project by selecting them all before you click the Add button.
Important: You must rebuild the project to which you added the new activity files before you can add them to your workflow.
When you build the project, any activities that are defined in the new files are added to the toolbox in a section that is named interfaceassemblyprojectname Components
Step 4: Add the new activities to the workflow
You can now add your strictly bound activities to your workflow. Drag an instance of the activity from the toolbox to the correct position in the workflow on the workflow designer.
For more information about generating strictly bound activities, see Generating Communication Activities.
For more information about the wca.exe tool, see Windows Workflow Foundation Tools