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 use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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?

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

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

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/enus/library/system.data.linq.datacontext.executedynamicupdate.aspx)



Leave a Reply 0

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