nerdexam
Microsoft

70-516 · Question #80

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an…

The correct answer is A. context.Refresh(RefreshMode.StoreWins, entity). LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option. AcceptAllChanges Accepts all changes made to objects in the object context. Refresh(RefreshMode, Object) Updates an…

Querying Data

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You retrieve an entity from an object context. A different application updates the database. You need to update the entity instance to reflect updated values in the database. Which line of code should you use?

Options

  • Acontext.Refresh(RefreshMode.StoreWins, entity);
  • Bcontext.LoadProperty(entity, "Client", MergeOption.OverwriteChanges);
  • Ccontext.AcceptAllChanges() ;
  • Dcontext.LoadProperty(entity, "Server", MergeOption.OverwriteChanges);

How the community answered

(31 responses)
  • A
    74% (23)
  • B
    6% (2)
  • C
    13% (4)
  • D
    6% (2)

Explanation

LoadProperty(Object, String) Explicitly loads an object related to the supplied object by the specified navigation property and using the default merge option. AcceptAllChanges Accepts all changes made to objects in the object context. Refresh(RefreshMode, Object) Updates an object in the object context with data from the data source. ObjectContext.Refresh Method (RefreshMode, Object)

Topics

#Entity Framework#Refresh#RefreshMode.StoreWins#concurrency

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice