问题
I would like the rule for which "Persist activities cannot be contained within no persistence blocks" error happens in WF4. I see that you can not persist between the first receive-send, but I do not understand the general idea.
Any comment?
Thanks
回答1:
The goal of a no persist zone it to indicate that you are doing something that can't be resumed from the middle of it. For example a Receive and SendReply action, if you persist in the middle you can also resume from there if the workflow aborts at some later point. If you resume before the SendReply the first step after resuming is to send the reply but as there is no request there is no place to send the reply to. The same is try for a TransactionScope, you can't restart in the middle of the transaction.
So basically whenever you drop a persist activity on the workflow think of is as being able to resume the workflow from that point after reloading it from disk.
来源:https://stackoverflow.com/questions/3475416/persist-activities-cannot-be-contained-within-no-persistence-blocks-error