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.

有帮助吗?

解决方案 2

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

其他提示

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.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top