Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to assign an argument to the variable in Workflow Foundation 4.0?
    primarykey
    data
    text
    <p>This simple code fails with the following error:</p> <p><strong>The following errors were encountered while processing the workflow tree:</strong></p> <p><strong>'ArgumentValue': The argument named 'Parameter' could not be found on the activity owning these private children. ArgumentReference and ArgumentValue should only be used in the body of an Activity definition.</strong></p> <p>I also tried VisualBasivValue("Parameter") instead of ArgumentValue, and the error was:</p> <p><strong>The following errors were encountered while processing the workflow tree:</strong></p> <p><strong>'VisualBasicValue': Compiler error(s) encountered processing expression "Parameter". 'Parameter' is not declared. It may be inaccessible due to its protection level.</strong></p> <p>How to do it properly?</p> <p>I tried to build something similar in Xaml, and it works, here is the code:</p> <pre><code>&lt;Assign sap:VirtualizedContainerService.HintSize="242,58"&gt; &lt;Assign.To&gt; &lt;OutArgument x:TypeArguments="x:String"&gt;[variable]&lt;/OutArgument&gt; &lt;/Assign.To&gt; &lt;Assign.Value&gt; &lt;InArgument x:TypeArguments="x:String"&gt;[Parameter]&lt;/InArgument&gt; &lt;/Assign.Value&gt; &lt;/Assign&gt; </code></pre> <p>Looks like it references the parameter somehow, but how...</p> <p>How can I do it in code? Here is my simple scenario:</p> <pre><code>public class RootActivity : NativeActivity { public InArgument&lt;string&gt; Parameter { get; set; } public Activity Activity { get; set; } public RootActivity() { var variable = new Variable&lt;string&gt;("V1", "This is my variable!"); var activity = new Sequence { Variables = {variable}, Activities = { new Assign&lt;string&gt; { To = new OutArgument&lt;string&gt;(variable), Value = new InArgument&lt;string&gt;( new ArgumentValue&lt;string&gt;("Parameter")); }, } }; this.Activity = activity; } protected override void Execute(NativeActivityContext context) { context.ScheduleActivity(this.Activity); } } </code></pre> <p>Thanks a lot for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload