【发布时间】:2015-08-28 06:30:38
【问题描述】:
//adding parameters and invoking workflow but the properties inside the codeactivity is all
static void Main(string[] args)
{
Activity workflow1 = new Workflow1();//activity
IDictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("toFolder", @"C:\BackupByWorkFlow");//param1
parameters.Add("fromFolder", @"C:\");//param2
WorkflowInvoker.Invoke(workflow1, parameters);//invoke
}
// workflow1 contains sequence of activities
// sequence->WhileBackup activity -> and other custom activities
//Custom code activity in workflow is as below
public sealed class WhileBackup : CodeActivity
{
// Defining properties
public InArgument<string> Text { get; set; }
public InArgument<string> toFolder { get; set; }//property is null
public InArgument<string> fromFolder { get; set; }//property is null
public int totalFiles { get; set; }
public int currentFile;
public FileInfo[] files;
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
// Obtain the runtime value of the Text input argument
string text = context.GetValue(this.Text);
}
}
工作流的in-argument值不为null,但同一工作流中的代码活动相同为null。因此我想知道如何将工作流的in参数的值传递给代码活动属性。
【问题讨论】:
标签: c# asp.net workflow-foundation-4