I'm using WF 3.5 and looking for a way to develop an activity preserving its state among different iterations of the standard WF "while" activity. The problem is that normally the Execute() method of an activity should return the "Closed" execution status. Once it did that - it cannot get back to the "Executing" state and in the next iteration a new clone of the activity is used and thus we lose the state of the first one. For example, I want my activity to sample the next line of an input file in each iteration. It requires maintaining a cursor for this file or in other words it requires a state. How can I achieve this functionality?
A:
Why do you need to close your workflow? It seems it has not finished yet :) Consider have a loop and not closing until you have finished with it.
If you must close it and need to store the line number of the file for the "next run". Perhaps store that on the enitity it's running from.
Or having two workflows a controler that stores the file line number and calls the child workflows to do the processing.
Chris Jones
2009-10-05 16:28:00