I have a fairly complex query where I am filtering results with a LIKE statement. Here is the query:
var qsFilter = entities.QueryStatements.Where("it.Statement LIKE @searchTerm",
new ObjectParameter("searchTerm", searchTerm));
var qtFilter = entities.QueryTables.Where("it.TableNames LIKE @searchTables",
new ObjectParameter("searchTables", searchTerm));
And then:
var tables = from t in entities.TraceLines
join qs in qsFilter on t.QueryStatementHash equals qs.QueryStatementHash
join qt in qtFilter on qs.QueryTableHash equals qt.QueryTableHash
where t.CallTypeId == 64
orderby t.Sequence
select new
{
Name = qt.TableNames
};
The problem is that in the final query, it generates an AND clause for the 2 LIKE filters:
WHERE ([Filter1].[Statement] LIKE @searchTerm) AND
([Extent3].[TableNames] LIKE @searchTables)
How do I get that to be an OR clause?
Note: if you are wondering why I am using ESQL here, it is because of this: http://stackoverflow.com/questions/3095781/how-to-use-sql-like-with-linq-to-entities