- Microsoft Windows Workflow Foundation 4.0 Cookbook
- Andrew Zhu
- 300字
- 2021-04-13 17:00:35
In this task, we will create a WF program using InOutArgument
. This type of argument is used to receive values and is also used to pass values out to the caller (WF host).
- Create a workflow project:
Create a new Workflow Console Application under the
Chapter01
solution and name the project asUseInOutArgument
. - Author a workflow:
Create an
InOutArgument
type argument:InOutMessage
. Author a WF program as shown in the following screenshot. In the Assign activity textbox, type InOutMessage = "Now, I am an OutMessage". - Write code to host the workflow:
Open the
Program.cs
file and alter the code as shown:using System; using System.Activities; using System.Activities.Statements; using System.Collections.Generic; namespace UseInOutArgument{ class Program{ static void Main(string[] args){ IDictionary<string, object> input = new Dictionary<string, object>() { {"InOutMessage","Now, I am InMessage"} }; IDictionary<string,object> output= WorkflowInvoker.Invoke(new Workflow1(),input); Console.WriteLine(output["InOutMessage"]); } } }
- Run it:
Set
UseInOutArgument
asStartup
project. Press Ctrl+F5 to build and run the workflow without debugging. The application should run in a console window and print the message as shown in the following screenshot:

The following code block initializes the InArgument
value:
IDictionary<string, object> input = new Dictionary<string, object>() { {"InOutMessage","Now, I am InMessage"} };
This statement will run the workflow program with the input dictionary.
IDictionary<string,object> output= WorkflowInvoker.Invoke(new Workflow1(),input);
The string Now, I am InMessage is printed by the workflow. The string Now, I am an OutMessage is a message altered in the workflow and passed to the host and then printed by the host program.
We cannot assign a string to InOutArgument
directly, and the following style of parameter initialization is not allowed:
IDictionary<string, object> output = WorkflowInvoker.Invoke(new Workflow1() { InOutMessage="Now,I am InMessage" });
- 自己動手寫分布式搜索引擎
- Oracle VM Manager 2.1.2
- BPEL Cookbook: Best Practices for SOA/based integration and composite applications development
- SPSS進階分析與實務
- 中文版CorelDRAW X6基礎培訓教程
- Drupal 6 Panels Cookbook
- ASP.NET 3.5 Application Architecture and Design
- PS App UI設計從零開始學
- 新編AutoCAD制圖快捷命令速查一冊通
- 詳解AutoCAD 2022電氣設計(第6版)
- MATLAB在日常計算中的應用
- UG NX 11中文版從入門到精通
- 藝術二維碼設計與制作完全攻略 PHOTOSHOP+ILLUSTRATOR+FLASH
- 手把手教你學成Excel高手
- 同花順軟件操作技巧與實戰指南