>>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:
>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