Search

Search:

Namespace:

Search Result
.
Summary
Represents the default version of WorkflowCommitWorkBatchService created by the workflow runtime engine if no other WorkflowCommitWorkBatch service is added.
.

The purpose of the DefaultWorkflowCommitWorkBatchService service is to enable custom logic for the commitment of work batches (also known as persistence points). When a work batch is committed, the workflow runtime calls into the DefaultWorkflowCommitWorkBatchService service and gives it a delegate to call to do the actual committing of the work batch. The runtime still has to do the commit; but it allows the service to insert itself into the process for customization around the commit process.

.

The only true requirement of the DefaultWorkflowCommitWorkBatchService service is to create a transaction if one does not already exist when its CommitWorkBatch method is called. If a transaction does not exist (which occurs when the Current property returns null) the DefaultWorkflowCommitWorkBatchService must create a transaction and set the ambient transaction before calling the CommitWorkBatchCallback delegate. This is done by wrapping the delegate call with a TransactionScope.

.

The primary reason for this service type is to enable custom error-handling logic. If the DefaultWorkflowCommitWorkBatchService service owns the transaction, because it created one when Current returns null (Nothing in Visual Basic), it can call the delegate more than once, creating a new transaction for each call. The most common example of this is to handle intermittent network problems or SQL cluster failovers. If the call to the CommitWorkBatchCallback throws an exception, WorkflowCommitWorkBatchService can catch this exception, start a new transaction, and call the delegate again. This gives a level of resilience to workflow instance execution that otherwise would cause workflows to terminate.

.

http://msdn2.microsoft.com/en-us/library/system.workflow.runtime.hosting.defaultworkflowcommitworkbatchservice.aspx

.

Depending on the object used to call GetService a number of RuntimeServices might not be returned, a null/Nothing is returned instead. This is the case with a ActivityExecutionContext which will not return any of the following: WorkflowSchedulerService, WorkflowPersistenceService, TrackingService, WorkflowCommitWorkBatchService, WorkflowLoaderService or the WorkflowRuntime itself.

.
            <add type="System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService, 
.

The SqlWorkflowPersistenceService participates in the workflow transaction batching functionality provided by the WorkflowCommitWorkBatchService. That is, it adds objects that represent pending writes to the SQL database to the WorkBatch and implements the IPendingWork interface.

.
  • WorkflowCommitWorkBatchService
.

The purpose of the Windows workflow transaction services (WorkflowCommitWorkBatchService) is to enable custom logic regarding the commitment of work batches (also known as PersistencePoints). When a work batch is committed, the runtime calls into the current transaction service and passes a delegate to call to do the actual committing of the work batch. The runtime still must do the commit, but letting a service insert itself into the process enables some customization around the commit process.

.

The WF framework does not support the ability to bring your own transaction from the outside into a workflow instance. The only types of ambient transactions supported by the WorkflowCommitWorkBatchService are transactions that are originated by the workflow instance. Ambient transactions that are originated by the host application executing the workflow runtime are temporarily removed from the current thread to reduce their side effects. After the workflow is idle, the host application original ambient transaction contained by is placed back in the thread.

.

WF provides two out-of-box implementations for transaction services: DefaultWorkflowCommitWorkBatchService and SharedConnectionWorkflowCommitWorkBatchService.

.

The WF runtime engine requires a workflow transaction service. By default, it uses the DefaultWorkflowCommitWorkBatchService. The host application can choose to replace the DefaultWorkflowSchedulerService with SharedConnectionDefaultWorkflowCommitWorkBatchService or with a custom service.