To pass parameter to Workflow.
First we need to create a local variable and property in the workflow class.
private string _message = string.Empty;
public string Message
{
get { return _message; }
set { _message = value; }
}
From our hosting application to pass the value for the parameter,
we need to create a generic Dictionary object which uses String for key and Object as value for the parameter.
Key for parameter should exactly match the public property in the workflow.
Dictionary<String, object> wfParam = new Dictionary<string, object>();
wfParam.Add(“Message”, “My Hello World”);
Now we need to pass this Dictionary object to the workflow using one of the overloaded method for CreateWorkflow
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(HelloWorldWorkflow.Workflow1),wfParam );
Bye…
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.
