c# - .First() timing out while .ToList() works fine -
i'm having weird issue ".first()"-ing iqueryable:
var tests = dbset .where(p => productids.contains(p.productid.tostring()) || p.productgroups.any(pg => pg.groupedid == groupedid)) .select(p => p.tests.where(t => t.statusid == 1 && t.testtype == 1)); var testlist = tests.tolist(); var testfirst = tests.firstordefault();
the .tolist() runs fine , in less second, .first() seemingly slow , times out. can round problem doing tests.tolist().firstordefault() thought slower?
also, if change initial query simpler:
var tests = dbset .where(p => productids.contains(p.productid.tostring())) .select(p => p.tests.where(t => t.statusid == 1 && t.testtype == 1));
the .first() works fine? it's or in .where() combined .first().
if explain what's happening here great!
Comments
Post a Comment