You are implementing a method that uses Entity Framework to update a Product entity. You add the following code:

public void UpdateProduct(Product product)
using (AdventureWorksEntities context = new AdventureWorksEntities())


When you execute the code, you find that the product is not updated. You need to modify the code to ensure that the product is updated.

What should you do?

 Posted by Rajkatie on 9/30/2012 | Category: ADO.NET Interview questions | Views: 1569 | Points: 40
Select from following answers:
  1. After attaching the updated product, call the ApplyOriginalValues method of the Product's ObjectSet with the original Product entity.
  2. Replace the call to Attach with a call to the ObjectContext's AddObject method.
  3. Call the ObjectContext's method AcceptAllChanges method before calling SaveChanges.
  4. All Above

Show Correct Answer

Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response