This is my code:
var test = (from x in myDb.myTable
where (x.name == tmp || x.name == tmp2 || x.name == tmp3) && x.unit == u
select x).FirstOrDefault();
if (test == null)
test = (from x in myDb.myTable
where (x.name == tmp || x.name == tmp2 || x.name == tmp3)
select x).FirstOrDefault();
How to optimize it>?
tmp
andtmp2
(which are bad variable names, BTW) as theirname
, why is it okay to get any one of them? What is the schema of your table? How many rows does your table have? Does it have any indexes? – svick Jan 21 '13 at 15:46