So I've been banging my head against the proverbial wall for a few hours and I thought I'd see if anybody else has solved this problem before...
I have a List<string>
of values that I want to use as filters on a search. In the olden days I would build a string of WHERE field = 'a' OR field = 'b' OR field = 'C'
into the query. But with Linq building that long WHERE
clause is rather difficult. What I was hoping would work was:
var results = from x in x.table
where x.Equals(List<string>)
select x;
Alas, the compiler isn't smart enough to break down the List<> into a WHERE field = 'a' OR field ='b'
kind of query. I've moved ahead with this process as a foreach loop on the List<string>
but it's pushing processing to the client when I want that part of the execution to take place on the SQL Server. Am I living in fantasy land here or is there a way to make this happen?