nerdexam
Microsoft

70-516 · Question #103

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to retrieve an entity, and…

The correct answer is D. NoTracking. AppendOnly-Objects that do not exist in the object context are attached to the context. If an object is already in the context, the current and original values of object's properties inthe entry are not overwritten with data source values. The state of the object's entry and…

Querying Data

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to retrieve an entity, and you must ensure that the entity is loaded in a detached state. Which MergeOption enumeration value should you use to retrieve the entity?

Options

  • APreserveChanges
  • BOverwriteChanges
  • CAppendOnly
  • DNoTracking

How the community answered

(37 responses)
  • A
    11% (4)
  • B
    5% (2)
  • C
    5% (2)
  • D
    78% (29)

Explanation

AppendOnly-Objects that do not exist in the object context are attached to the context. If an object is already in the context, the current and original values of object's properties inthe entry are not overwritten with data source values. The state of the object's entry and state of properties of the object in the entry do not change. AppendOnly is the default merge option. OverwriteChanges-Objects that do not exist in the object context are attached to the context. If an object is already in the context, the current and original values of object's properties in the entry are overwritten with data source values. The state of the object's entry is set to Unchanged, no properties are marked as modified. PreserveChanges-Objects that do not exist in the object context are attached to the context. If the state of the entity is Unchanged, the current and original values in the entry are overwritten with data source values. The state of the entity remains Unchanged and no properties are marked as modified. If the state of the entity is Modified, the current values of modified properties are not overwritten with data The original values of unmodified properties are overwritten with the values from the data source. NoTracking-Objects are maintained in a Detached state and are not tracked in the ObjectStateManager. However, Entity Framework-generated entities and POCO entities with proxies maintain a MergeOption Enumeration

Topics

#Entity Framework#MergeOption#NoTracking#detached entity

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice