Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VS 2013 can not evaluate expression
Message
 
 
General information
Forum:
ASP.NET
Category:
Troubleshooting
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01605242
Message ID:
01605503
Views:
38
>>I posted an idea in EF web-site. Anyone who wants to vote on it, please add your vote.
>>
>>https://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/6286842-for-char-nchar-and-varchar-nvarchar-columns-use-th
>
>Not my field and I may be misunderstanding. In the link Rob posted it implies that using cmd.Parameters.AddWithValue will set a fixed length - but at the expense of adding multiple plans for each different string length. Snip:
// produces an nvarchar(7) parameter
>cmd.Parameters.AddWithValue(
>"SELECT * FROM authors WHERE au_fname = @name", "@name", "Johnson");
I wonder if padding 'Johnson' to the length of the field would be a reasonable compromise ?

Hi Viv,

I think you misunderstood the problem. I am not using ADO.NET and AddWithValue (BTW, even when I use ADO.NET I always use Parameters.Add method and specify the type and size).

In this project we're using EF. When I was profiling, I found that EF uses varchar(8000) for the parameters even if the column is, say, char(6). Right now I can not say if it will cause any problems or not (I read a few StackOverflow questions on that same problem). Most likely it's not really a big deal, but if EF team can fix this problem, then why not?

That's what my suggestion is about.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform