Queries on non unicode string column should not prefix strings with N
Steps to reproduce
If a column is configured with a non n* string type, say char(3), then the SQL builder should not prefix strings in the generated SQL with a N. For example:
builder.Property<string>("Discriminator").IsRequired().HasColumnType("char(3)");
results in:
...WHERE ([x].[Discriminator] IN (N''obj'', N''int'', N''dbl'', N''dec'')
Running that query in SMSS returns the execution plan warning:
Type conversion in expression (CONVERT_IMPLICIT(nchar(3),[Table].[Discriminator],0)=N'obj') may affect "SeekPlan" in query plan choice
Removing the N string prefix removes the warning.
I have performed some non scientific experiments on a query and here are some results (elapsed time in ms): Without N With N 557 536 515 581 495 562 494 585 536 500 529 582 510 502 525 590 518 531 511 622 Average 519 559,1
So by removing the N prefix, the query actually runs faster
Further technical details
EF Core version: 1.0.0
Did you try this with 1.1 preview 1
@ErikEJ Nope, I am not running on those bits yet.
This should be fixed in 1.1. You can try out preview1 which includes the fix.
in EF Core 2.0 still happening this issue
@fchiumeo - Please file a new issue with the query in which you are seeing this error.
@smitpatel done #9582