70-516 · Question #48
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Framewok. You need to execute custom logic when an entity is attached to the ObjectContext…
The correct answer is C. Create an event handler to handle the ObjectStateManagerChanged event. ObjectStateManagerChanged Occurs when entities are added to or removed from the state ObjectMaterialized Occurs when a new entity object is created from data in the data source as part of a query or load operation. ObjectStateManagerChanged Event…
Question
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Framewok. You need to execute custom logic when an entity is attached to the ObjectContext. What should you do?
Options
- ACreate a partial method named OnStateChanged in the partial class for the entity.
- BCreate a partial method named OnAttached in the partial class for the entity.
- CCreate an event handler to handle the ObjectStateManagerChanged event.
- DCreate an event handler to handle the ObjectMaterialized event.
How the community answered
(17 responses)- A12% (2)
- B6% (1)
- C82% (14)
Explanation
ObjectStateManagerChanged Occurs when entities are added to or removed from the state ObjectMaterialized Occurs when a new entity object is created from data in the data source as part of a query or load operation. ObjectStateManagerChanged Event us/library/system.data.objects.objectstatemanager.objectstatemanagerchanged.aspx) ObjectMaterialized Event us/library/system.data.objects.objectcontext.objectmaterialized.aspx)
Topics
Community Discussion
No community discussion yet for this question.