Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

ADO.NET Entity Framework's CompiledQuery when using anonymous projections shows why C# needs "mumble" types

Ok, that's a really long title for a post, so what the heck do I mean by all that? Well, I've started working with the CompiledQuery class and I've run into a language limitation problem that almost makes any kind of performance gain I might get from CompiledQuery not worthwhile when using projections due to the fact that they cannot be anonymous so you're forced to define a new class yourself to represent the projection. First off, if you're not familiar with CompiledQuery, it's basically an optimization provided by the ADO.NET Entity Framework that enables it to take your LINQ expression once, generate a cached execution plan (not in the SQL sense, but in the entity sense) for it and return you a Func delegate on the fly that takes parameters to allow you to plug in any dynamic values you might need for the query (e.g. for a where clause). Secondly, if you're not familiar with the C# "mumble" type problem, jump on over to this excellent post from Ian Griffiths where he details the issues Read More...
Published Thursday, May 15, 2008 3:28 PM by hacked.brain

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us