For those of you who's blog readers don't always get updated (rather than brand new) blog entries, there's a happy ending to my last "fixed-almost" blog entry on EDM 4.0 and parameterization. I've heard that this has been fixed to generate VARCHAR(8000) parameters and also that the unparameterized version:
var x = from a in ents.authors
where a.au_lname == "Smith"
select new { a.au_lname, a.au_fname };
will generate …WHERE au_lname = 'Smith' instead of …WHERE au_lname = N'Smith'.
Note that this is a different semantic; they generate a parameter type that agrees with the column's data type rather than using the .NET string type's data type equivalent (NVARCHAR). This will be better for performance because the database and parameter types agree.
Fix is coming in next beta version of .NET 4.0. I've updated the original blog entry to note this as well.
One thought on “L2S and EF parameterization problem will be fixed in .NET 4.0 – completely”
Hi Bob
The point about the N notation that injects the .NET type was a subtlety that I missed. THat’s why it’s important to have friends who are DBAs! 🙂
And a small update – it’s 4000 not 8000. At least in Beta 1.
(http://thedatafarm.com/blog/data-access/upgrading-ef-projects-to-ef4-don-t-forget-to-target-net-4-0/)
Julie
Comments are closed.