0

sIDs contains IDs of string type. In second query I want to get all records with ids that are contained in sIDs. Because sIDs is string array I get error in where sIDs.Contains(t.Id). I cannot either to use where sIDs.Contains(t.Id.ToString()) because EF doesn't support ToString in query. I thought to convert sIDs to int array and then I could use where CONVERTED_TO_INT_IDs.Contains(t.Id).

Is there another way to do this?

var sIDs = (from t in cxt.myTbl
            select t.Parameters).ToList();

var oList = (from t in cxt.myTbl2
             where sIDs.Contains(t.Id)
             select t).ToList();
theateist
  • 13,879
  • 17
  • 69
  • 109

1 Answers1

0

Take a look at the answer here: Problem with converting int to string in Linq to entities

(btw that's the first google match when searching for "ef tostring")

Community
  • 1
  • 1
Andreas
  • 6,447
  • 2
  • 34
  • 46