What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application uses the ADO.NET Entity Framework to model entities.
The application allows users to make changes while disconnected from the data store.
Changes are submitted to the data store by using the SubmitChanges method of the DataContext object.
You receive an exception when you call the SubmitChanges method to submit entities that a user has changed in offline mode.
You need to ensure that entities changed in offline mode can be successfully updated in the data store.
What should you do?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application uses the ADO.NET Entity Framework to model entities.
The application allows users to make changes while disconnected from the data store.
Changes are submitted to the data store by using the SubmitChanges method of the DataContext object.
You receive an exception when you call the SubmitChanges method to submit entities that a user has changed in offline mode.
You need to ensure that entities changed in offline mode can be successfully updated in the data store.
What should you do?

A.
Set the ObjectTrackingEnabled property of DataContext to true.

B.
Set the DeferredLoadingEnabled property of DataContext to true.

C.
Call the SaveChanges method of DataContext with a value of false.

D.
Call the SubmitChanges method of DataContext with a value of System.Data.Linq.ConflictMode.ContinueOnConflict.

Explanation:
ObjectTrackingEnabled Instructs the framework to track the original value and object identity for this DataContext.

ObjectTrackingEnabled Property
(http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.objecttrackingenabled.aspx)



Leave a Reply 1

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


Mike

Mike

If you’re using the EntityFramework then you’d be using the SaveChanges method on an ObjectContext – not SubmitChanges on a DataContext.