We're not big fans of Entity Framework, as we don't directly expose the database structure to the client program but rather through stored procedures and functions. So, EF for us is a tool to expose those stored procedures as .NET wrappers. This limited use of EF still greatly automates the data access code.
But what we have lately found is that the EF has a problem with char parameters. Namely, if you import a procedure say MyProc that accepts char(1), and then will call it through the generated wrapper, the you will see in sql profiler that char(1) parameter is passed with many trailing spaces as if it were char(8000). There isn't necessity to prove that this is highly ineffective.
MyProc
char(1)
char(8000)
We can see that the problem happens in VS 2010 designer rather than in the EF runtime, as SP's parameters are not attributed with length, see model xml (*.edmx):
<Function Name="MyProc" Schema="Data"> ... <Parameter Name="recipientType" Type="char" Mode="In" /> ... </Function>
while if we set:
<Parameter Name="recipientType" Type="char" MaxLength="1" Mode="In" />
the runtime starts working as expected. So the workaround is to fix model file manually.
See also: Stored Proc and Char parm
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u