自定义活动成员变量状态的 MS 工作流问题
我有一个带有私有成员变量(整数)的简单自定义活动。
当我将它放在 while 活动内的序列活动中并开始迭代时,我遇到了一个问题:
我的成员变量在每次迭代中都归零,即使我每次执行活动时都会将其加一。
我做错了什么?
谢谢,
阿迪巴尔达
I have a simple custom activity with a private member variable (integer).
When i put it inside a sequence activity which is inside a while activity and start iterating i have a problem:
My member variable is zeroed in each iteration even though i increment it by one every time the activity is executed.
What am i doing wrong?
Thanks,
Adi Barda
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有看到代码,很难说,但是当您在 While 活动中工作时,您必须小心如何修改子活动的状态。 While 活动生成多个执行执行上下文,并将从模板克隆您的活动(换句话说 - 您不会多次执行同一活动,工作流会创建自定义活动的多个实例)。 请参阅:http://blogs.msdn.com/advancedworkflow/ archive/2006/03/21/557121.aspx 和 http: //msdn.microsoft.com/en-us/magazine/cc163414.aspx
Without seeing the code it is hard to say, but when you are working inside of a While activity you have to be careful how you modify state on your child activities. The While activity spawns multiple execution execution contexts and will clone your activity from a template (in other words - you aren't executing the same activity multiple times, the workflow creates multiple instances of your custom activity). See: http://blogs.msdn.com/advancedworkflow/archive/2006/03/21/557121.aspx and http://msdn.microsoft.com/en-us/magazine/cc163414.aspx