Tried this:
.Where("MyColumnID.Contains(@0)", myArray)
But what i got was:
No applicable method 'Contains' exists in type 'Int32'
Any other ways? Something like SqlMethods.Like, but in DynamicLinq?
Tried this:
.Where("MyColumnID.Contains(@0)", myArray)
But what i got was:
No applicable method 'Contains' exists in type 'Int32'
Any other ways? Something like SqlMethods.Like, but in DynamicLinq?
The Contains()
operator works the other way around: It's the array which contains the number, thus it should read as follows:
"@0.Contains(MyColumnID)"
I am however, not sure if this is even possible within DynamicLinq. This other SO question deals with the same problem:
Query data using "Contains" keyword in Dynamic Linq in C#
It suggests the following should work:
int[] CandidateIdsArray = new int[]{4, 78, 101}
var dynamicLinqQuery =
Candidates.Where("@0.Contains(CandidateId)", CandidateIdsArray);