Blog Stats
  • Posts - 3
  • Articles - 1
  • Comments - 17
  • Trackbacks - 0


Saturday, May 12, 2012

How to do debugging with visual studio 2008/2010 ?


If you have good debugging skill then you can save lots of time. In visual studio  lots of options are  available for debugging.

Here are some good URL for debugging. It will be really useful in our daily working project.

Debugging in  loop

Debugging in Store Procedure

I hope it will help to someone

Sunday, April 29, 2012

PreCompile query is now available in EF 5.0 i.e in VS 2011


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;





Previously   “db.ContextOptions.DefaultQueryPlanCachingSetting”  property was not there in previous version.

Monday, April 9, 2012

Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported.


I was doing some test with code first approach in EF. Then while populating the Gridview i was getting error like this

Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList().

For solving this error we have to write the code like this

 private void FillGrid()
            using (var Context = new EmpDatabaseContext())
                var query = Context.Emps.Select(m => m);
                //var query = from m in Context.Emps
                //            select m;
               // Gridview1.DataSource = query;
                Gridview1.DataSource = query.ToList();
  We canot bind Iqueryable directly. We have to change into ToList()


Copyright © Chandradev