70-516 · Question #59
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the EntityFramework. The application has an entity named Person. A Person instance named…
The correct answer is A. model.DeleteObject(person1). ObjectContext.DeleteObject Marks an object for deletion from the ObjectStateManager. The object is deleted in the data source when the SaveChanges method is called. ObjectContext.ExecuteStoreCommand Method executes an arbitrary command directly against the data source using the…
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the EntityFramework. The application has an entity named Person. A Person instance named person1 and an ObjectContext instance named model exist. You need to delete the person1 instance. Which code segment should you use?
Options
- Amodel.DeleteObject(person1);
- Bmodel.Detach(person1);
- Cmodel.ExecuteStoreCommand("Delete",
- Dmodel.ExecuteStoreCommand("Detach",
How the community answered
(32 responses)- A75% (24)
- B16% (5)
- C6% (2)
- D3% (1)
Explanation
ObjectContext.DeleteObject Marks an object for deletion from the ObjectStateManager. The object is deleted in the data source when the SaveChanges method is called. ObjectContext.ExecuteStoreCommand Method executes an arbitrary command directly against the data source using the existing connection.
Topics
Community Discussion
No community discussion yet for this question.