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.
Chandradev | Microsoft Community Contributor 2011
My Blog [Life is wonderful if you know how to live life]
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.
Recently i tested in my stystem with sample code, If
db.ContextOptions.DefaultQueryPlanCachingSetting
property is showing then make ensure that autocompile query is working. In previous version this propery was not there
isisis
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;
GridView1.DataBind();
}
Chandradev | Microsoft Community Contributor 2011
My Blog [Life is wonderful if you know how to live life]
Marked as answer by chandradev1 on Apr 30, 2012 05:09 AM
chandradev1
Participant
1563 Points
474 Posts
How to confirm the "Auto compile of query" in EF 5.0 ?
Apr 21, 2012 01:05 PM|LINK
Hi
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.
My Blog
[Life is wonderful if you know how to live life]
TimoYang
Contributor
3732 Points
1275 Posts
Re: How to confirm the "Auto compile of query" in EF 5.0 ?
Apr 23, 2012 02:50 AM|LINK
Hi,
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.
chandradev1
Participant
1563 Points
474 Posts
Re: How to confirm the "Auto compile of query" in EF 5.0 ?
Apr 28, 2012 02:35 PM|LINK
Hi
Recently i tested in my stystem with sample code, If
db.ContextOptions.DefaultQueryPlanCachingSetting
property is showing then make ensure that autocompile query is working. In previous version this propery was not there
isisis
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; GridView1.DataBind(); }My Blog
[Life is wonderful if you know how to live life]