About Applycurrentvalues and applyoriginalvalues differences in EF

Source: Internet
Author: User

About Applycurrentvalues and applyoriginalvalues differences in EF: Both are used when editing data.

//
Summary:
Will System.Data.Objects.ObjectStateEntry's System.Data.Objects.ObjectStateEntry.CurrentValues
property is set to match the property value of the provided object.
//
Parameters:
Currententity:
The detached object that has the property update to apply to the original object.
//
return Result:
The object that was updated.

Public TEntity applycurrentvalues (TEntity currententity)

There are two ways to take the value of parameter currententity

(1) Identify the object from memory, edit the field you want to edit, and then pass in.

(2) A new object created with the newly keyword, note that the created object must satisfy the data table constraint and then pass in.

//
Summary:
Will System.Data.Objects.ObjectStateEntry's System.Data.Objects.ObjectStateEntry.OriginalValues
property is set to match the property value of the provided object.
//
Parameters:
Originalentity:
The detached object that has the property update to apply to the original object.
//
return Result:
The object that was updated.

Public TEntity applyoriginalvalues (TEntity originalentity);

There is only one way to take the value of parameter originalentity

(1) The objects that are isolated from memory, edit the fields you need to edit, and then pass in.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.