My following query is not including the where condition in sql query plan.
var userStandby = await _context.UserStandby
.FirstOrDefaultAsync(standBy => ECUserId.Equals(standBy.ECUserId, StringComparison.OrdinalIgnoreCase));
i am using EF Core 2.1 and the UserStandby table has got 12500 records. I am getting timeout error as the query is not including the where condition.
Can anyone please help me how to resolve this?
thanks
Try this instead
var userStandby = await _context.UserStandby
.Where(standBy => ECUserId.Equals(standBy.ECUserId, StringComparison.OrdinalIgnoreCase))
.FirstOrDefaultAsync();
You put your condition in the Where expression and with firstordefault you say that you want only 1 result or null.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.