我试图传递一个复杂的对象ScriptControl
,作为工作流的In参数。我得到的错误是:
`The following errors were encountered while processing the workflow tree:
'Literal<ScriptControl>': Literal only supports value types and the immutable type System.String. The type ScriptDisplay.ScriptControlcannot be used as a literal.`
我是工作流程的新手,我了解问题,但如何解决?
答案 0 :(得分:1)
没有看到你的代码,我无法确定,但这通常是由使用WorkflowInvoker引起的。 e.g。
WorkflowInvoker.Invoke(workflow,ScriptControl)
这样做的方法是将复杂的对象放入字典中。
ScriptControl scriptControl= new ScriptControl{ initialise your object here };
Dictionary<string, object> inputDictionary = new Dictionary<string, object> { { "ScriptControl", scriptControl } };
var output = WorkflowInvoker.Invoke(workflow, inputDictionary );
然后像往常一样使用字典来访问scriptControl对象。
e.g。
var x = dictionary["ScriptControl"].some property of your ScriptControl object