Bulk update and delete for Lightspeed

Source: Internet
Author: User

1.Update
For bulk operations, either update or remove is done using the Lightspeed query object.

Note: Student is the table (entity) to be update, Stuname is the one used in table student for querying

var stuquery = new Query (    typeof (Student),    entity.attribute ("stuname") = = "Lao Wang");

This query object is equivalent to a where. The specific SET statement is implemented in the code below.

New  );

The age of student, Stuname equals "Lao Wang", is updated to 25.

It is important to note that the above update object is an anonymous type, and an error "Cannot assign <null> to an anonymous type attribute" If a property needs to be updated to null

This requires a class or struct to be hosted. As follows

New NULL  }); struct agestruct{    publicintsetget;}}

2.Remove

Bulk deletion is almost the same as a bulk update, except that the last step is to use the Remove method instead of update.

Bulk update and delete for Lightspeed

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.