Which two actions should you perform?

You use Microsoft Visual Studio 2010 and Microsoft NET Framework 4 to create a multi-tier
application. You use Microsoft ADONET Entity Data Model (EDU) to model entities. The model
contains entities named Sales Order Header and Sales Order Detail. For performance considerations
in querying sales order header you detach SalesOrderdetail entities from Object Context. You need
to ensure that changes made to existing Sales Order Detail entities updated Hi other areas of your
application are persisted to the database. Which two actions should you perform?

You use Microsoft Visual Studio 2010 and Microsoft NET Framework 4 to create a multi-tier
application. You use Microsoft ADONET Entity Data Model (EDU) to model entities. The model
contains entities named Sales Order Header and Sales Order Detail. For performance considerations
in querying sales order header you detach SalesOrderdetail entities from Object Context. You need
to ensure that changes made to existing Sales Order Detail entities updated Hi other areas of your
application are persisted to the database. Which two actions should you perform?

A.
Re-attach the Sales Order Detail entities.

B.
Set the Merge Option of Sales Order Detail to Merge Options overwrite Changes

C.
Set the Merge Option of Sales Order detail to Merge Options NoTracking

D.
Call Object ContextApplyCurrentValue

E.
Call Object ContextApplyOriginalValue

Explanation:
ApplyCurrentValues(Of TEntity) Copies the scalar values from the supplied object into the object in
the ObjectContext that has the same key.
The ApplyCurrentValues<TEntity> method is used to apply changes that were made to objects
outside the ObjectContext, such as detached objects that are received by a Web service. The method
copies the scalar values from the supplied object into the object in the ObjectContext that has the
same key. You can use the EntityKey of the detached object to retrieve an instance of this object
from the data source. Any values that differ from the original values of the object are marked as
modified.
Note, the method does not apply the current values to the related objects of currentEntity.
ApplyOriginalValues(Of TEntity) Copies the scalar values from the supplied object into set of original
values for the object in the ObjectContext that has the same key.
The ApplyOriginalValues<TEntity> method is used to apply changes that were made to objects
outside the ObjectContext, such as detached objects that are received by a Web service. The method
copies the scalar values from the supplied object into the object in the ObjectContext that has the
same key. You can use the EntityKey of the detached object to retrieve an instance of this object
from the data source. Any values that differ from the current values of the object are marked as
modified.
Note, the method does not apply the current values to the related objects of originalEntity.



Leave a Reply 0

Your email address will not be published. Required fields are marked *