I have a question that should be easy, but I myself could not find the answer.
I am using EF4 CTP-5 Code First Model with manually created POCOs. It treats string comparisons in generated SQL as
WHERE N'Value' = Object.Property
I know that I can override this functionality using:
[Column(TypeName = "varchar")] public string Property {get;set;}
Which fixes the problem for this single occurrence and generates SQL correctly like:
WHERE 'Value' = Object.Property
However, I am dealing with a VERY large domain model and going through each string field and setting TypeName = "varchar" will be very tedious. I would like to point out that EF should see the string as varchar throughout the board, as this is the standard in this database, and nvarchar is an exception.
The reason for correcting this is the efficiency of query execution. The comparison between varchar and nvarchar is very inefficient in SQL Server 2k5, where the varchar-varchar comparison is performed almost immediately.
c # entity-framework-4 ef-code-first code-first
VulgarBinary Feb 24 '11 at 18:58 2011-02-24 18:58
source share