c# - Windows Workflow: Output from CodeActivity to input on next CodeActivity -
I can figure out how I pass data from a custom CodeActivity as a result in the next CodeActivity, I'm trying to An input sequence as
Here is the code I have so far:
private static void DemoWorkflow () {var s = new sequence () {DisplayName = "Sequence1" , Variables = {New Variable & lt; String & gt; {Name = "TestParam", default = "hello"}}, actions = {new method 1 () {text = "test 1234"}, new Method2 ()}}; Var settings = new TextExpressionCompilerSettings {AlwaysGenerateSource = true, ActivityName = "sequence", ActivityNamespace = "System.Activities.Statements", ForImplementation = false, activity = s, language = "C #", RootNamespace = null, GenerateAsPartialClass = false} ; Var result = new TextExpressionCompiler (settings) .Compile (); If (Result. Horse Errors) {new exception throw ("compilation fail."); } Var compiledExpressionRoot = Activator.CreateInstance (result. ResultType, new Object [] ICompiledExpressionRoot as {S}); Compressed Expression Encoder .Set Compedited Expression Root (S, Compiled Expression Route); WorkflowInvoker.Invoke (s); }} Public Category Method1: CodeActivity & lt; String & gt; {[ExpectedAuthoring] Public Inclusion & lt; String & gt; Lesson {Receive; Set; } Execute safe override string (CodeActivityContext context) {var inText = this.Text.Get (reference); Console.WriteLine (intext); Return from "Method 1:" + Intext; }} Public Category Method2: CodeActivity {Public InArgument & lt; String & gt; Lesson {Receive; Set; } Perform safe override zero (CodeActivityContext context) {var inText = this.Text.Get (reference); Console.WriteLine (intext); }}
I think Method2 should print "Text 1: Test 1234 from Method 1" but it's not currently.
You are not bound to the variable Method1 :: Results
< Code> OutArgument & LT; String & gt; or Method2 :: Text
Inorder
var v = new variable & lt; String & gt; {Name = "TestParam", default = "Hello"}; Var s = new sequence () {DisplayName = "Sequence1", variable = {v}, Activities = {new Method1 () {text = "test1234", result = new OutArgument & LT; String & gt; (V)}, new Method2 () {text = new allowance & lt; String & gt; (V)}}};
Comments
Post a Comment