0

Windows Workflow Foundation 4.5 を使用しています。

WriteLine アクティビティに引数を渡したい。以下のようにコードします。

class Program
{
    static void Main(string[] args)
    {
        WriteLine wf1 = new WriteLine();
        wf1.Text = "arg1";

        Dictionary<String, Object> arg = new Dictionary<String, Object>();
        arg.Add("arg1", "Hello,world!");

        WorkflowInvoker.Invoke(wf1, arg);
    }
}

しかし、実行時に次のエラーが発生します。

Unhandled Exception: System.ArgumentException: The values provided for the root activity's arguments
 did not satisfy the root activity's requirements:
'WriteLine': The following keys from the input dictionary do not map to arguments and must be remove
d: arg1.  Please note that argument names are case sensitive.

それで、それを行う正しい方法は何ですか?

4

1 に答える 1

1

引数の名前は「テキスト」です。これはうまくいきます:

class Program
{
    static void Main(string[] args)
    {
        WriteLine wf1 = new WriteLine();

        Dictionary<String, Object> arg = new Dictionary<String, Object>();
        arg.Add("Text", "Hello,world!");

        WorkflowInvoker.Invoke(wf1, arg);
    }
}
于 2013-08-27T21:41:21.483 に答える