C
C#2y ago
BokoGanga

EF Core Querying a List of Rows

Hey devs, I'm trying to optimize a query that checks DB for user with email. I have a list of emails that I need to check if they exist in the table of Users. Is there anyway in EF Core that allows checking by a list instead of looping through it and sending a request for each one? Thank you.
2 Replies
FroH.LVT
FroH.LVT2y ago
use Contains. Eg: listOfEmails.Contains(x.Email)
BokoGanga
BokoGanga2y ago
yeah, that worked perfectly. Thanks a lot