I’m trying to create a search method where I’m wanting to check whether the keywords is contained within a any of number of different columns for a given record.
My Linq statement is as follows:
string[] searchFilter = {"john", "iceberg"};
var q = from qua in qual
join del in deliverables on qua.ID equals del.Q_ID
where searchFilter.All(s => (qua.Name + " " + qua.Project + " " + qua.Summary + " " + del.Name + " " + del.Summary).ToLower().Contains(s))
select qua;
I’m however getting an error message which states: “Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator.”
The contains method for whatever reason was not using the filtered results when it came through the loop a second time around. The approach that eventually worked was: