问题
I've made few tests regarding the new EF5 auto-compiled queries feature. The problem is that I don't see any difference in the performance.
I've made one project with .NET 4.0 and EF4.0 without using compiled queries. I've made another project with .NET 4.0 and EF4.0 with compiled queries - there was 50% improvement in performance.
And then I tried to create a project with EF 5.0, in which there was basically no difference in performance.
All the projects were asp.net mvc (first two were version 3, the last one - version 4).
Am I missing something here ? Is there something special I need to do to enable the auto-compile feature ? I just created MVC 4 project with pre-build EF5 inside.
The query I am testing with is rather verbose, three joins and multiple filters inside.
Thank you
回答1:
Auto compiled queries are available in the part of EF5 live in the .NET Framework 4.5. If you are running EF5 on .NET Framework 4 queries are not automatically compiled.
回答2:
Pawel,
Thanks for answering. Actually, I downloaded .NET 4.5 from the MS site :
http://www.microsoft.com/en-us/download/details.aspx?id=30653
I installed it, I also got .NET 4.5 target as a setting in the project tab in Visual Studio and it's set. But when I look at the assemblies, they are all 4.0 .
I am not sure why this is happening.
I also upgraded to EF 6.0 alpha.
Still absolutely no performance improvement.
来源:https://stackoverflow.com/questions/13223353/regarding-the-new-ef5-auto-compiled-queries-feature