[英]Setting the argument's value in workflow c#
我正在使用Windows Workflow Foundation .NET 4.5.2。 我從CodeActivity內部在設計器中設置bool
類型的參數(也可能是變量)時遇到問題。
在設計器中,我設置了方向為In
bool
類型的newProject
參數。 (它應該有另一個方向嗎?即InOut
)。
在代碼中,我想將設計器的參數設置為true
。
public class Inquire : CodeActivity
{
public InArgument<bool> newProject { get; set; }
public InArgument<bool> rework { get; set; }
protected override void Execute(CodeActivityContext context)
{
Console.WriteLine("For a new project type 'new', for rework type 'rw'.");
string inquire = Console.ReadLine();
if (inquire == "new")
{
context.SetValue(newProject, true);
}
else
{
rework.Set(context, true);
}
}
}
設計器中的參數在過渡過程中得到了驗證,這使我能夠進入下一個狀態。 如果是true
,我可以進入下一個狀態。 問題在於設計器中的參數不會收到在上面的代碼中設置的新值。 如何做呢?
如果要將值傳遞回設計器,則需要將其設為Out參數或InOut參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.