Entity Framework Contains still defaulting to unicode for varchar fields - by BJJ1

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 650410 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 3/9/2011 9:53:39 AM
Access Restriction Public


Using the Contains extension method on a varchar field results in SQL that has unicode for the strings in the SQL's IN clause.

So far a varchar field 'Code' the resulting SQL is

WHERE [Extent1].[Code] IN (N'Code1', N'Code2', N'Code3')

when doing a cmpare this works as expected and you get

WHERE 'Code1' = [Extent1].[Code]
Sign in to post a comment.
Posted by André Saraiva on 4/19/2012 at 4:50 PM
Isn't there any hotfix or update for this issue yet?

Posted by Kati [MSFT] on 3/30/2011 at 4:13 PM
Thank you for submitting this issue. We are planning to address it for the next release.

Thank you,
Kati Iceva
Entity Framework Developer
Posted by Taz0 on 3/21/2011 at 8:04 AM
This still happens in EF 4.0, even though it was explicitly mentioned as fixed in section 5 of this article:


It seems the fix only applies to single values, and not to many other usage forms. This is unacceptable - it makes EF completely useless in even the most basic index seeks on non-Unicode columns. Please fix this!
Posted by Microsoft on 3/9/2011 at 9:20 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/9/2011 at 10:13 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)