How can I write Linq to Entities to make a where in clause similar to one in SQL Server? The issue is that the field I need to search against is nullable int.
I have following code, but it returns "Unable to create a constant value of type 'System.Collections.Generic.List`1'. Only primitive types ('such as Int32, String, and Guid') are supported in this context."
public IList<WantedInfoView> GetWanted(string idList)
{
List<int> contactIDList = new List<int>();
contactIDList = idList.Split(',').Select(n => int.Parse(n)).ToList();
IEnumerable<WantedInfoView> wantedList = (
from w in db.Wanteds
where contactIDList.Contains(w.contact_id)
select new WantedInfoView
{
...
}
);
}