PrepAway - Latest Free Exam Questions & Answers

Which ObjectContext method should you call?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model your entities.
You use Plain Old CLR Objects (POCO) entities along with snapshot-based change tracking. The code accesses the POCO entities directly.
You need to ensure that the state manager synchronizes when changes are made to the object graph.
Which ObjectContext method should you call?

PrepAway - Latest Free Exam Questions & Answers

A.
Refresh

B.
SaveChanges

C.
DetectChanges

D.
ApplyPropertyChanges

Explanation:
When working with POCO, you must call the DetectChanges method on the ObjectContext
to attach the POCO entity to the ObjectContext. Be sure to call DetectChanges prior to calling SaveChanges.

ApplyPropertyChanges Obsolete. Applies property changes from a detached object to an object already attached to the object context.

CHAPTER 6 ADO.NET Entity Framework
Lesson 2: Querying and Updating with the Entity Framework
Attaching Entities to an ObjectContext (page 438)


Leave a Reply