0
//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);
}
}
工作流的參數內值不爲null,但在同一工作流中的代碼活動中的值相同爲null。我想知道如何將工作流參數的值傳遞給代碼活動屬性。如何將Windows工作流的In參數參數傳遞給自定義代碼活動屬性?
非常感謝。現在它的工作正常。 – varkhedi