Search code examples
.networkflow-foundation-4workflow-foundationworkflow-activity

Changing variables and argument values in Code Activity in Windows Workflow Foundation


I am using Windows Workflow Foundation, and have created the flowchart using XAML designer and custom code activites. There are 4 Arguments in the Workflow - data, tableProvider, jobInfo and jsonConverter. The argument data is of type In/Out and it is used for flow of data from one activity to another. All the code activities have the data argument as the output. The other arguments are all In arguments and are set when the workflow is invoked and are not changed henceforth.

However due to some recent requirement changes, the custom activities should be able to change the value of the other arguments (jobInfo and tableProvider). Once changed the subsequent activities in the flowchart should be able to use the modified value of the argument.

Question is, If I just use arg.Set(ActivityContext, newValue), will I get the desired effect? Or is there a better or a more correct way to achieve this?


Solution

  • Yes, that's the way to set an argument inside a custom activity. The arguments must be In/Out or Out.