Using the TransactionScopeActivity Activity
A TransactionScopeActivity activity provides a convenient way for you to wrap .NET Framework System.Transactions, which automatically roll back their actions if an error occurs. For more information about System.Transactions, see the .NET Framework Transaction and TransactionScope classes and related types in the MSDN Library.
The TransactionScopeActivity activity supports rollback if an exception is thrown from it.
The TransactionScopeActivity TransactionOptions property enables you to set the System.Transactions transaction isolation level and time-out period. For more information, see the .NET Framework TransactionOptions structure in the MSDN Library. For a description of the transaction isolation levels, see the IsolationLevel enumeration in the MSDN Library.
You cannot nest a TransactionScopeActivity within any of the following activity types:
Another TransactionScopeActivity
Custom activity which is decorated with the PersistOnCloseAttribute attribute
Custom activity that implements ICompensatableActivity
Also, you cannot use a SuspendActivity activity in a TransactionScopeActivity activity.
Warning
If you create a workflow that uses the TransactionScopeActivity activity or custom activities that use the PersistOnCloseAttribute attribute, you must specify a persistence service to use, or an exception is thrown when you execute the workflow. For more information about persistence services, see Creating Custom Persistence Services.
For a code sample that demonstrates how the Windows Workflow Foundation engine unloads a workflow by saving the workflow instance state through a custom persistence service, see Custom Persistence Service.For more information, see the TransactionScopeActivity class of the System.Workflow.ComponentModel namespace in the Windows Workflow Foundation Class Library reference.
See Also
Reference
Concepts
Using Transactions in Workflows
Creating Custom WorkflowCommitWorkBatchService Services
Creating Custom Persistence Services
Other Resources
Custom Persistence Service
Windows Workflow Foundation Activities