PrepAway - Latest Free Exam Questions & Answers

What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server database. The application uses DataContexts to query the database.
The application meets the following requirements:
* Stores customer data offline.
* Allows users to update customer records while they are disconnected from the server.
* Enables offline changes to be submitted back to the SQL Server by using the DataContext object.

You need to ensure that the application can detect all conflicts that occur between the offline customer information
submitted to the SQL Server and the server version. You also need to ensure that you can roll back local changes.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add a try/catch statement around calls to the SubmitChanges method of the DataContext object and catch SqlExceptions.

B.
Add a try/catch statement around calls to the SubmitChanges method of the DataContext object and catch ChangeConflictExceptions.

C.
Override the Update operation of the DataContext object.
Call the ExecuteDynamicUpdate method to generate the update SQL.

D.
Call the SubmitChanges method of the DataContext object.
Pass System.Data.Linq.ConflictMode.ContinueOnConflict to the method.

Explanation:
FailOnFirstConflict Specifies that attempts to update the database should stop immediately when the first concurrency conflict error is detected.
ContinueOnConflict Specifies that all updates to the database should be tried, and that concurrency conflicts should be accumulated and returned at the end of the process.

ExecuteDynamicUpdate() Method Called inside update override methods to redelegate to LINQ to SQL the task of generating and executing dynamic SQL for update operations.

ConflictMode Enumeration
(http://msdn.microsoft.com/en-us/library/bb345922.aspx)

DataContext.ExecuteDynamicUpdate Method
(http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executedynamicupdate.aspx)

One Comment on “What should you do?


Leave a Reply