70-516 · Question #175
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…
The correct answer is C. TransactionScope(TransactionScopeOption.RequiresNew) D. TransactionScope(TransactionScopeOption.Suppress). 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…
Question
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.)
Options
- ATransactionScope(TransactionScopeOption.Required)
- BTransactionScope()
- CTransactionScope(TransactionScopeOption.RequiresNew)
- DTransactionScope(TransactionScopeOption.Suppress)
How the community answered
(36 responses)- A8% (3)
- B17% (6)
- C75% (27)
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
Topics
Community Discussion
No community discussion yet for this question.