问题
I'm studying Microsoft WF samples and have found that they serializing/deserializing workflows that are not finished to hold its state. I don't like it as workflow is a process and it doesn't need any additional data to continue from a different thread or code part.
Maybe I've missed something. Can you share examples of saving/loading unfinished workflows if it's possible? Maybe alternative workflow frameworks can do without serialization/deserialization. For example it could be restored from business object state.
回答1:
You're thinking far too small. There are many uses beyond what you can imagine right now. All workflow frameworks (unless they use some type of object db?) will serialize the workflow state so it can be continued at a later time. Microsoft WF, K2 BlackPerl and many others do this. K2 does it because you can have an item going through workflow v1 and then right in the middle someone will update the workflow to v2 but K2 is smart enough to know that is should continue processing that item under the v1 workflow.
Maybe i'm missing your question but it seems like you don't like that it serializes the workflow for storage.
来源:https://stackoverflow.com/questions/5092530/workflow-foundation-deserialization-from-business-objects