Hi
Now in EF 5.0 i.e in VS 2011 default supporting the “Precompile
query”. Previously this feature was not
there in EF. It will really give very good performance. Now no need to write
any code for this functionality.
Just now, i tested
the code, We can also disable this feature like this.
protected void Page_Load(object sender, EventArgs e)
{
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();
}
}
Previously “db.ContextOptions.DefaultQueryPlanCachingSetting”
property was not there in previous
version.