With pure EF, you're right: you need to load objects one by one, set a property, and save. Very inefficient.
The 2 alternatives that I know of are as follows:
Quote from your homepage:
Batch update and deletion
The current limitations of the Entity Framework are to update or delete an object that you must first retrieve into memory. Now in most scenarios this is fine. However, there are some senerons in which performance will suffer. In addition, for single deletes, an object must be retrieved before it is deleted, requiring two calls to the database. Batch updating and deletion eliminates the need to retrieve and load an object before modifying it.
Delete
//delete all users where FirstName matches context.Users.Where(u => u.FirstName == "firstname").Delete();
Update
//update all tasks with status of 1 to status of 2 context.Tasks.Update( t => t.StatusId == 1, t2 => new Task {StatusId = 2}); //example of using an IQueryable as the filter for the update var users = context.Users.Where(u => u.FirstName == "firstname"); context.Users.Update(users, u => new User {FirstName = "newfirstname"});
source share