What should you do?

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?

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.
?Move the database update logic to a BackgroundWorker thread. �Ensure that the thread is enclosed in a TransactionScope Using block in the BackgroundWorker DoWork method.

B.
?Use TransactionScope in a Using block on the UI thread. �Batch the database updates by setting the DbDataAdapter.UpdateBatchSize property to 2.

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.



Leave a Reply 0

Your email address will not be published. Required fields are marked *