I would like to produce a query that has multiple OR statements from my memory side list. The query is something like:
SELECT * FROM table WHERE (name = 'John' AND location = 'San Francisco') OR (name = 'Mike' AND location = 'Los Angeles') ... so on
The parentheses are the items of the memory side list. Here is a sample of what I tried but there is an error caused by comparing sql-side data against memory-side data. I would like to create the query before executing it since this is a very large table.
List<Tuple<string, string>> nameLocationList = new List<Tuple<string, string>>();
nameLocationList.Add(new Tupple<string, string> ("John", "San Francisco"));
nameLocationList.Add(new Tupple<string, string> ("Mike", "Los Angeles"));
var data = context.table.Where(t => nameLocationList.Contains(new Tuple<string, string> (t.name, t.location))).toList();
But I got an error of:
{"Unable to create a constant value of type 'System.Tuple`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. Only primitive types or enumeration types are supported in this context."}