4 ms·
var user = db.Users.ToList().Find(x => x.Name.Equals(name)); It's even worse. This will literally retrieve all Users into memory and then iterate over it. Ever
by atraac 6y ago
var user = db.Users.ToList().Find(x => x.Name.Equals(name));
It's even worse. This will literally retrieve all Users into memory and then iterate over it. Every time you want to find this single one.
Looks like the person who wrote it never actually wrote a single backend server using Entity Framework. It also does so synchronously, while async method is available. This means that this thread will be locked until it finishes this IO and won't be able to process anything else.