EntityFramework Core 7 multi update/delete

Date: 2023-06-05

https://stackoverflow.com/a/74207956

dbContext.Users
    .Where(u => u.Id == someId)
    .ExecuteUpdate(b =>
        b.SetProperty(u => u.Password, "NewPassword")
    );
    
    
// Delete users that haven't been active in 2022:
dbContext.Users
    .Where(u => u.LastActiveAt.Year < 2022)
    .ExecuteDelete();
    
78330cookie-checkEntityFramework Core 7 multi update/delete