开始我的工作流程并坚持使用此代码:
public void StartAndUnloadInstance(Activity WorkflowName, IDictionary<string, object> **parameters**)
{
sqlWorkflowInstanceStore = SetupSqlpersistenceStore();
AutoResetEvent waitHandler = new AutoResetEvent(false);
WorkflowApplication wfApp = new WorkflowApplication(WorkflowName,parameters);
wfApp.InstanceStore = sqlWorkflowInstanceStore;
wfApp.PersistableIdle = (e) =>
{
return PersistableIdleAction.Unload;
};
wfApp.Unloaded = (e) =>
{
waitHandler.Set();
};
wfApp.OnUnhandledException = (e) =>
{
wfApp.Abort();
waitHandler.Dispose();
waitHandler.Set();
throw new Exception();
};
wfApp.Run();
waitHandler.WaitOne();
wfApp.Unload();
}
我将参数值传递给工作流程如下:
var cwobj = new Dictionary<XName, object>();
cwobj.Add("ContractorId", contractorId);
cwobj.Add("OfferPrice", offerPrice);
cwobj.Add("Description", description);
cwobj.Add("RequestNumber", requestNumber);
cwobj.Add("RequestTitle", requestTitle);
cwobj.Add("ComponentId", componentId);
当我开始工作流程并坚持认为我得到了所有论证的价值 WorkflowDataContext,现在我想为参数发送新值,但我不知道为什么让我持久的旧参数值