Linq to entites and contains method

  • Thread starter Thread starter RBScheer
  • Start date Start date
R

RBScheer

Hi.

I am trying to simulate the IN operator in Linq to entites using a
List of integers, like below:

Dim lstFound As IList(Of Entities.Local) = Nothing

Dim ls As New List(Of Integer)
ls.Add(21)
ls.Add(38)

lstFound = (From a In context.Local Where a.Area = 1 And
ls.Contains(a.LocalCode)).ToList

When I run this code, I receive the following error:

"LINQ to Entities does not recognize the method 'Boolean
Contains(Int32)' method, and this method cannot be translated into a
store expression."

Can you help me to see what is wrong here or on how to do a correct IN
using integers?

Regards,
Robert Scheer
 
Back
Top