Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 将参数绑定到Windows工作流实例&;忽略未使用的_.net_Workflow Foundation - Fatal编程技术网

.net 将参数绑定到Windows工作流实例&;忽略未使用的

.net 将参数绑定到Windows工作流实例&;忽略未使用的,.net,workflow-foundation,.net,Workflow Foundation,我在字典中有一组命名值参数,我希望将其传递到不同的工作流中。问题是每个工作流只需要字典中属性的一个子集,我事先不知道哪个工作流需要哪些属性 问题是,当我使用要绑定的字典调用WorkflowRuntime.CreateWorkflow时,它会失败,原因是: The activity '<workflow name>' has no public writable property named '<property name>' 活动“”没有名为“”的公共可写属性 我知道

我在
字典
中有一组命名值参数,我希望将其传递到不同的工作流中。问题是每个工作流只需要字典中属性的一个子集,我事先不知道哪个工作流需要哪些属性

问题是,当我使用要绑定的字典调用WorkflowRuntime.CreateWorkflow时,它会失败,原因是:

The activity '<workflow name>' has no public writable property named '<property name>'
活动“”没有名为“”的公共可写属性
我知道这意味着什么。未定义工作流中的属性,因为此特定工作流不需要该特定属性(其他工作流可能需要)


是否可以将字典绑定到工作流属性,并忽略工作流中未定义的属性?

为什么不将字典传递到工作流实例中?然后,您的工作流定义必须具有该字典的属性

var inputs = Dictionary<string, YOUR_CUSTOM_TYPE>();
// ...
// fill your dictionary according to the context
// ...
var inputParams = new Dictionary<string, object>();
inputParams["WF_PROP_NAME"] = inputs;
var wfInstance = wfRuntime.CreateWorkflow(WF_TYPE, inputParams);
var inputs=Dictionary();
// ...
//根据上下文填写词典
// ...
var inputParams=新字典();
inputParams[“WF_PROP_NAME”]=输入;
var wfInstance=wfRuntime.CreateWorkflow(WF_类型,inputParams);
这样,您的工作流就可以从字典中获取感兴趣的字典项

var inputs = Dictionary<string, YOUR_CUSTOM_TYPE>();
// ...
// fill your dictionary according to the context
// ...
var inputParams = new Dictionary<string, object>();
inputParams["WF_PROP_NAME"] = inputs;
var wfInstance = wfRuntime.CreateWorkflow(WF_TYPE, inputParams);