MS Workflow Foundation inheritance and activity
I have two questions. 1. Why is the working class "SEALED"? Is it a bad practice to inherit workflows? 2. The while operation is slow. IE .: I have put 3 actions on seqential wf in this order ... Code_activity1 While_activity Code_activity2 (during activity)
Code_activity1 - sets the counter int 33320. While_activity - loops up to counter> 0. Code_activity2 - decreases the counter by 1 (counter -);
Now the problem is that it takes too long to complete the whole workflow (about 20 minutes).
If I do the same manually by code :,
int counter = 33320;
while(counter>0)
counter--;
It takes about 1 millisecond.
Why is the while activity so slow?
thanks
1) Even though the generated class is sealed as in
public sealed partial class Workflow1: SequentialWorkflowActivity
there is nothing to stop you from removing the sealed keyword and inheriting from it. I think you generally don't want to inherit from a workflow that you design and seal is said to give you some performance benefits.
2) http://msdn.microsoft.com/en-us/library/ms735819.aspx explains a little how the activity works. You add the specified child activity creation 33320 times, all the events that fire when the activity is executed / initialized, etc., and all the additional activities that the workbench needs to handle, and you get 20 minutes.
a source to share