Just getting started with WF4.
Ran into a problem with passing some text from a native code activity (located in the middle of a sequential workflow) onto the next (xaml-based) activity in a sequence.
Here is a quick synopsis: a custom native code activity makes a DB call and needs to pass the result to a standard "SendReplyToRecive" activity (which is the last activity in this workflow). There is a global variable "reportValue" defined at the top-level sequence level, but I'm struggling to get to it from within that custom native code activity.
The design surface for this workflow does not offer Arguments, just Variables and Imports, so, I'm not even sure if I could use OutArgument.
How is this done?
If your custom NativeActivity is defined to return a value, like this:
public sealed class MyCustomNativeActivity : NativeActivity<int>
{
protected override void Execute(NativeActivityContext context)
{
context.SetValue<int>(base.Result, 10);
}
}
You should now be able to set the returned value to a Variable using Result property through the designer.
EDIT:
Check this sample image. In your MyCustomNativeActivity you'll have available a Result property. To assign the value returned to a variable just initialize that variable and put it in the Result field.
From that point on you can use that variable wherever you want.
Notice that in the sample MyCustomNativeActivity the returned value is an Int32 but it can be any other type.