作为属性的 WF4 参数
我的场景如下: 我有一个工作流程(我们称之为 customActivity1),可以为我的系统执行基本操作。我还有另一个工作流程 (customActivity2),它使用 customActivity1 并执行更高级别的操作。当我调用 customActivity1 时,我必须传递一些参数,例如布尔值或字符串值。我想将其中一些参数显示为复选框或组合框(以便 customActivity2 的开发人员只能传递有效值),并发现我可以通过将参数设置为 PROPERTY(而不是 In)来做到这一点。 通过研究,我还发现不能直接在表达式中使用此参数,因此我的 customActivity1 上不断出现错误。
也就是说,我知道我需要缩小设计师可以传递的内容,在不使用活动设计师的情况下我该如何做到这一点,或者我在哪里可以找到答案?
我还附上了两张图片,一张是我需要的,另一张是我遇到的错误。
提前致谢。
My scenario is the following:
I have a workflow (lets call it customActivity1) that do the basic actions for my system. I also have another workflow (customActivity2) that uses customActivity1 and do higher level actions. When I call customActivity1, I must pass on a few parameters, like Boolean or String values. I want to show some of these parameters as a checkbox or combobox (so the developer of customActivity2 can pass on only valid values) and found out that I can do that by setting the argument as PROPERTY (instead of In).
By doing a research, I also found out that you can’t directly use this argument in expressions, so I keep getting errors on my customActivity1.
That said and knowing that I need to narrow what the designer can pass on, how could I do that without using an activity designer or where could I find an answer?
I also attached two pictures, one of what I need and the other of the error I’m getting.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
InArgument 只显示文本字段而不是复选框的原因是它们是表达式而不是文字值。不过,仍然存在类型检查,如果您输入值 1,您会收到错误消息,指出整数无法转换为布尔值。
The reason an InArgument only shows you a text field instead of a checkbox is because they are expressions not literal values. There is still type checking though, if you enter the value 1 you get the error message that an integer cannot be converted into a boolean.
你不能这样做。您只能绑定到 InArguments。
如果您绑定 InArgument 并查看 xaml,您将看到类似以下内容:
工作流运行时知道如何处理这些。它不知道如何处理绑定 POCO 属性。
You cannot do this. You can only bind to InArguments.
If you bind an InArgument and look at the xaml, you'll see something like this:
The Workflow Runtime knows how to handle these. It doesn't know how to handle binding POCO properties.
如果您想要对数据流进行建模,但希望在属性网格中获得不同的用户体验,我建议使用参数(因为它们传达数据流语义)并为这些参数自定义属性网格。 WF4 示例中有一个示例演示了如何执行此操作(示例自述文件位于 http://msdn.microsoft.com/en-us/library/ee834515.aspx)
If you want to model data flow but want to have a different user experience in the property grid I recommed using arguments (as they convey data flow semantics) and customizing the property grid for those arguments. There is a sample that demonstrates how to do this in the WF4 samples (sample readme available at http://msdn.microsoft.com/en-us/library/ee834515.aspx)