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

 

Saturday, May 12, 2012

How to do debugging with visual studio 2008/2010 ?


Hi

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.

http://www.codeproject.com/Articles/309781/Advanced-Debugging-in-Visual-Studio
http://weblogs.asp.net/scottgu/archive/2010/08/18/debugging-tips-with-visual-studio-2010.aspx
http://www.codeproject.com/Articles/79508/Mastering-Debugging-in-Visual-Studio-2010-A-Beginn
http://www.dotnetperls.com/debugging
http://geekswithblogs.net/sdorman/archive/2009/02/14/visual-studio-2008-debugging-ndash-the-watch-window.aspx

Debugging in  loop

http://www.c-sharpcorner.com/uploadfile/suchit_84/debugging-tips-using-visual-studio/
http://blog.dreamlabsolutions.com/post/2008/12/11/Debugging-tips-and-tricks-for-Visual-Studio.aspx

Debugging in Store Procedure


http://codeasp.net/blogs/chandradev/microsoft-net/1901/how-to-debug-store-procedure-in-sqlserver

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


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.

Monday, April 9, 2012

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


Hi

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();
                Gridview1.DataBind();
            }
        }
  We canot bind Iqueryable directly. We have to change into ToList()
 

 

Copyright © Chandradev