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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -