在工作流活动之间共享数据
我有一个自定义活动列表(用 C# 代码编写),其中每个活动都派生自 NativeActivity,现在我借助 foreach 循环将所有这些活动添加到序列中。 现在的问题是,如果我需要从一项活动中获取一些价值并将其传递给另一项活动,我应该如何进行。
比方说,activity1 将字符串属性值设置为“某个文件名”(提供图像文件路径),并基于它旁边的活动(借助 for 循环将其添加到序列中),将其作为输入翻转该图像。
获取文件的逻辑在activity1的execute方法中,与activity2的execute方法中翻转图像的逻辑相同。
提前致谢
I m with a list of custom activities(written in code behind, C#) where each is derived from NativeActivity, now I'm adding all these activities to a sequence with the help of a foreach loop.
now the question is, how I should proceed if I need to get some value from an activity and to pass it on to another activity.
Say, activity1 sets a string property value to "some file name"(lets an image file path) and based on that the activity next to it which so ever is added into the sequence with the help of for loop, takes it as input to flip that image.
Logic for getting the file is thre in Execute method of activity1 and the same to flip the image in Execute method of activity2.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是我在实际实现中所做的,不需要任何争论/争论,变量“共享数据”足以保存跨活动的数据。
现在,在重写代码活动“执行”方法的每个活动级别,您必须使用此代码摘录来获取输入/获取此工作流变量“SharedData”的值。
希望这可以帮助其他人..
感谢其他人的帮助和支持。
This is what i Did for the actual implementation, there is no need of any inargument/outargument, The variable "Shared Data" is capable enough to hold the data across activities.
Now at each activity level in overridden code activity "Execute" method, you must use this excerpt of code to fetch input/fetch the value of this workflow variable, "SharedData".
Hope this might help others..
Thanks everyone else out there for their help n support.
这就是我所做的,并且不知何故它正在发挥作用。我不确定它的正确方法,建议我一些建议!!,这里 ActivityResult 是通过某种接口成员在各种添加的活动之间共享的属性。
this is what I did, and somehow it is working. I'm not sure as its right approach, suggest me something Will!!, here ActivityResult is property which is shared among the various added activities, via some sort of Interface member..