Select from following answers:- Call the ObjectContext's method Refresh method before calling SaveChanges.
- Call the ObjectContext's method AcceptAllChanges method before calling SaveChanges.
- Replace the call to Attach with a call to the ObjectContext's AddObject method and After attaching the updated product, call the ChangeObjectState method of the ObjectContext's ObjectStateManager. Set the EntityState to Added.

- All Above
In the Entity Framework, objects can be attached to, or detached from, an object context. Objects that are attached to an object context are tracked and managed by that object context. When a query is executed inside an object context in the Entity Framework, the returned objects are automatically attached to the object context. You can attach objects that have been returned from a remote method call or web service by calling the Attach method. Entities are attached in an Unchanged state. You must call the ChangeObjectState method of the ObjectContext's ObjectStateManager and set the EntityState to Added to ensure that it is marked for insertion.
Show Correct Answer
Source: MeasureUp.Com | |
Alert Moderator