Question

I am using EF 4.1 Code First. EF generates a query for the IN clause is :

SELECT Column1
FROM Table1 
WHERE Column1 IN (N'ABC',N'XYZ', N'DEF')

The IN clause is generated by using List.Contains() method.

Is there any way so that I can remove unicode values (N character) from in clause ? So the query should look like

SELECT Column1
FROM Table1 
WHERE Column1 IN ('ABC','XYZ', 'DEF')

Any help in this regard is appreciated.

Note: I have specified all the column type as mentioned in DB.

Was it helpful?

Solution 2

I am able to convert list of unicode strings into Non unicode strings.

OTHER TIPS

I'm not sure but..

  1. Check Column1 Type on your EF model (Unicode property) to be set to false.
  2. Be sure do not apply any string functions like "Trim" or smthng similar. This will convert your db value in a unicode string.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top