I'm struggling to get what I thought would be a simple LINQ-to-SQL query to work. I can construct the query ok and can verify that the SQL it generates is correct but when executing get the dreaded "System.NotSupportedException: Queries with local collections are not supported" exception.
I've simplified my query but in short the query below works:
var query = from asset in context where new[] { 1, 2, 3 }.Contains(asset.code) select asset
this query also works:
var query = from asset in context where new List<int>() { 1, 2, 3 }.Contains(asset.code) select asset
But the query below will fail when an attempt is made to get the result set:
List<int> myList = new List<int>(){1, 2, 3};
var query = from asset in context where myList.Contains(asset.code) select asset
Anyone solved this sort of issue?