在WF4中,如何定义可以作为变量范围的自定义活动?
当我重新托管设计器时,我可以声明变量及其范围。然而,并非所有活动都可以成为变量的作用域。我注意到 Sequence、Parallel、PickBranch 可以作为主机,但 Pick、If、Delay 则不能。目前我的所有自定义活动都不能成为变量的范围。我应该怎么做才能使自定义活动能够成为变量的范围?
When I rehost a designer, I can declare variables and their scopes. However, not all activities can be the scope of a variable. I notice Sequence, Parallel, PickBranch can be the host, but Pick, If, Delay, can't. And all of my custom activities currently cannot be the scope of a variable. What should I do to make a custom activity able to be the scope of variables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只有向可以执行多个子活动的活动添加变量才有意义。因此,If、Delay 等不能,而 Sequence、While 等可以。
如果您想创建自己的复合活动,请添加公共 Collection;变量{获取; } 添加到您的活动并在构造函数中初始化集合。
It only makes sense to add variables to activities that can have multiple child activities execute. As a result If, Delay etc can't and Sequence, While etc can.
If you want to create you own composite activity add a public Collection<Variable> Variables { get; } to your activity and initialize the collection in the constructor.