views:

90

answers:

1

Hello,

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  A: 

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.

Maurice
Nice explanation, but in that case, why is the persistbeforesend option in the sendreply activity? It is very strange for me.
Pablo Castilla
The name is wrong, It persists after sending the response.
Maurice
Are you totally sure that the name is wrong? Ït would be a serious mistake.
Pablo Castilla
It schedules the persist before sending the resonse but because of the async nature it actually executes afterwards. And besides how would it resume of it's first step woul dbe to send a response over a no longer existsing connection?
Maurice