70-516 · Question #206
You develop a Microsoft .NET application that uses Entity Framework to store entities in a Microsft SQL Server 2008 database. While the application is disconnected from the database, entities that…
The correct answer is D. context.ApplyCurrentValues("Customers", localCustomer). See the full explanation below for the reasoning.
Question
You develop a Microsoft .NET application that uses Entity Framework to store entities in a Microsft SQL Server 2008 database. While the application is disconnected from the database, entities that are modified, are serialized to a local file. The next time the application connects to the database, it retrieves the identity from the database by using an object context named context and stores the entity in a variable named remoteCustomer. The application then serializes the Customer entity from the local file and stores the entity in a variable named localCustomer. The remoteCustomer and the localCustomer variables have the same entity key. You need to ensure that the offline changes to the Customer entity is persisted in the database when the ObjectContext.SaveChanges() method is called. Which line of code should you use?
Options
- Acontext.ApplyOriginalValues("Customers", remoteCustomer);
- Bcontext.ApplyOriginalValues("Customers", localCustomer);
- Ccontext.ApplyCurrentValues("Customers", remoteCustomer);
- Dcontext.ApplyCurrentValues("Customers", localCustomer);
How the community answered
(23 responses)- A13% (3)
- B4% (1)
- C9% (2)
- D74% (17)
Community Discussion
No community discussion yet for this question.