Summary: add a one or paragraph summary or description of what's discussed here; put yours after 'Summary:' Both a WorkBatch and TransactionScopeActivity can be used to do transactional work in a workflow. The difference is that the TransactionScopeActivity commits all work as soon as the TransactionScopeActivity is finished while a WorkBatch saves all items to commit and only commits them when the workflow runtime determines there is a CommitPoint. Batching also uses a TransactionScope so both are transactional. So what is the difference. Suppose your workflow doest some stuff, is unloaded into the persistence store, continues executing, starts an TransactionScopeActivity, doest some work, terminates the TransactionScopeActivity and then before the workflow is finished or persisted again has the runtime crash on it. Now the transaction has completed and is committed but the state of the workflow is still as it was last persisted, ie before the TransactionScopeActivity was executed. Suppose the runtime is restarted, it will detect and reload the workflow and continue from the unloaded point so do the TransactionScopeActivity again. Now if you use a WorkBatch to commit the data things work a little different. The WorkBatch is committed in a TransactionScope but this will include the WorkflowPersistenceService itself. So if the workflow runtime crashes before the batch is committed no work is saved at all and everything can safely be repeated. If on the other hand the batch is saved and the workflow runtime crashes after that the workflow will be restarted from the second time it was saved and not repeat the work done. A WorkBatch uses the IPendingWork interface to allow a service to commit work items.
You do not have permission to change this topic.