Developer bit
Bulk updates in Entity Framework
Use bulk updates to update entities with a single command (without the need of the change tracker).
Use bulk updates to update entities with a single command (without the need of the change tracker).
The entities will not be loaded into memory, which results in more efficient updates and deletes.
For more info, see my blog post "New in Entity Framework 7: Bulk Operations with ExecuteDelete and ExecuteUpdate", or the documentation.
// Use ExecuteDeleteAsync to delete entitiesawait.Set<CartItem>().ExecuteDeleteAsync();// Use Where as a filter to find specific entities (to delete or update)await.Set<CartItem>().Where(c=>.==).ExecuteDeleteAsync();// Use ExecuteUpdateAsync to update entitiesawait.Set<CartItem>().ExecuteUpdateAsync(s=>// Use SetProperty with a fixed value to update a property.SetProperty(p=>.,100));await.Set<CartItem>().Where(c=>.==2).ExecuteUpdateAsync(s=>// Use SetProperty to update a property using its current value.SetProperty(p=>.,v=>.+1));
Feel free to update this developer bit on GitHub, thanks in advance!