更新时间:2022-11-03 21:40:03
错误是因为列表未定义为 EF 实体.
The error was because the list isn't defined as an EF Entity.
最后,您不需要自己修改状态.
In the end, you don't need to modify the state youself.
List<User> usersList = _context.Users.Where(u => u.age >18).ToList();
usersList.ForEach(a => { a.isAdult = 1; });
_context.SaveChanges();