70-516 · Question #36
You are a tasked with performing a code review. The business rule is the following: - If INSERTs into the first table succeed, then INSERT into the second table. - However, if the INSERTs into the sec
The correct answer is D. try. Required A transaction is required by the scope. It uses an ambient transaction if one already 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 transac
Question
You are a tasked with performing a code review. The business rule is the following:
- If INSERTs into the first table succeed, then INSERT into the second
table.
- However, if the INSERTs into the second table fail, roll back the
inserts in the second table but do not roll back the inserts in the first table.
- Although this can also be done by way of regular transactions, It
needs to be performed using TransactionScope objects. Whis code would fit this business rule?
Options
- Atry
- Btry
- Ctry
- Dtry
How the community answered
(25 responses)- A4% (1)
- B4% (1)
- C12% (3)
- D80% (20)
Explanation
Required A transaction is required by the scope. It uses an ambient transaction if one already 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. Transaction Scope (EXAMPLE 3) TransactionScopeOption Enumeration
Topics
Community Discussion
No community discussion yet for this question.