You are analyzing a Windows client application that uses Microsoft Visual Studio 2010 and
Microsoft SQL Server 2008. The application updates two database tables from the main
user interface (UI) thread. You need to ensure that the following requirements are met: The
database tables are either updated simultaneously or not updated at all. Users are notified
of the success or failure of the updates. Users are able to perform other tasks during the
update process. What should you do?
A.
• Use TransactionScope in a using block on the UI thread. • Batch the database updates
by setting the DbDataAdapter.UpdateBatchSize property to 2.
B.
• Move the database update logic to a BackgroundWorker thread. • Ensure that the
thread is enclosed in a TransactionScopeusing block in the BackgroundWorker DoWork
method.
C.
• Use TransactionScope in a using block on the main thread. • Create a
BackgroundWorker thread within the block. • Move the database updates to the
BackgroundWorker DoWork method.
D.
• Use TransactionScope in a using block on the UI thread. • Create a
DependentTransaction object within the block and pass the object to the BackgroundWorker
ReportProgress method • Use the object in the ReportProgress method to create a new
TransactionScope block.