PrepAway - Latest Free Exam Questions & Answers

What are two possible TransactionScope constructors that you can use for the inner transaction to achieve this

You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database.
The application uses nested transaction scopes. An inner transaction scope contains code that inserts records into the database.
You need to ensure that the inner transaction can successfully commit even if the outer transaction rolls back.

What are two possible TransactionScope constructors that you can use for the inner transaction to achieve this goal?
(Each correct answer presents a complete solution. Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
TransactionScope(TransactionScopeOption.Required)

B.
TransactionScope()

C.
TransactionScope(TransactionScopeOption.RequiresNew)

D.
TransactionScope(TransactionScopeOption.Suppress)

Explanation:
Required – A transaction is required by the scope. It uses an ambient transaction if one already exists.
Otherwise, it creates a new transaction before entering the scope. This is the default value.
RequiresNew – A new transaction is always created for the scope.
Suppress – The ambient transaction context is suppressed when creating the scope.
All operations within the scope are done without an ambient transaction context.

TransactionScopeOption Numeration
(http://msdn.microsoft.com/en-us/library/system.transactions.transactionscopeoption.aspx)


Leave a Reply