Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 28, 2012 02:35 PM by chandradev1
Apr 21, 2012 01:05 PM|LINK
I read on MSDN blog that EF 5.0 is default supporting "auto compile" of query. How can i confirm that is working or not ? or where is the option to see ? I have installed VS 2011 beta in my pc. But i didnot observe this feature.
Apr 23, 2012 02:50 AM|LINK
I don't think you can "watch" that bcoz it's belonging to something nested in the bottom layer of EF since 5.0……Maybe you can see this：
Auto-Compiled LINQ to Entities Queries
The Entity Framework June 2011 CTP supports a new feature called Auto-Compiled LINQ Queries. Now every LINQ to Entities query that you execute automatically gets compiled and placed in EF’s query cache. Each additional time you run the query, EF will find
it in its query cache and won’t have to go through the whole compilation process again.
This also provides a boost to queries issued using WCF Data Services, as it uses LINQ under the covers.
How Does it Work?
The Entity Framework will walk the nodes in the expression tree and create a hash which becomes the key used to place it in the query cache. If it does not find the query in the cache then it will go ahead and compile it and store the compiled query in the
cache for subsequent use. Each subsequent time, the hash will be calculated and find the compiled query in the tree, thus saving the compilation overhead.
Apr 28, 2012 02:35 PM|LINK
Recently i tested in my stystem with sample code, If
property is showing then make ensure that autocompile query is working. In previous version this propery was not there
using (var db = new TestEntities())
// This line of code is used to disable the autocompile query
// db.ContextOptions.DefaultQueryPlanCachingSetting = false;
var query = db.tblEmps.Select(m => m);
GridView1.DataSource = query;