September 2008 - Posts

New Packages

There's been a few changes to products and packages offered by Infragistics lately, read on for the details.

A picture is worth a thousand words, so here goes.

clip_image001

 

Key takeaway: NetAdvantage for .NET includes ASP.NET, Windows Forms, Silverlight and WPF controls.  You asked for it, you got it.  If you already own NetAdvantage, you're likely entitled to some new (free) stuff which is detailed on our site.

 

New Products

In addition to the repackaging, we've introduced a completely new product - Icons.  There are packages for both Office Basics and Business & Finance which can be purchased separately, or combined for an even better value.  For $299, you can buy over 51,000 images to give your application the finishing touch of a professional designer.  By the way, if you do the math that comes out to $0.0059 per image.  I think you'll agree with me that you can't beat that deal.  Images come with PDF and XPS catalogs which can be printed so you can flip through them easily. 

I've decided that the LinqDataSource is my favorite datasource to use these days, because it allows me to consume my LinqToSql classes.  My fondness of Linq to Sql also leads towards frustration when I try to figure out what's going on behind the scenes.  

One method for debugging is to use Sql Profiler to see exactly what the sql server was asked to do.  This is a great starting point, because you can see exactly how your application interfaces with your database server.  It could be an eye opening experience.  In my case, it showed me that there was a select statement being done which asked for all rows in my table (hence the performance problem I was trying to understand)

Here's what a typical profile session will look like:

sqlprofilertrace

 

After staring at the Sql Profiler, I still needed more information.  Why was a select being done on my entire database?  Where was this coming from?  That led me back to my DataContext which was generated from my Linq To Sql designer.  The DataContext has a great feature - "Log".  It's a property right off of the context which accepts a TextWriter.  When you attach a TextWriter, it will output useful information to the stream.  In my case, I attached the log to the Debug window.  I found some great examples of how to do this (and use other output mechanisms) on DamienGuard's blog

I modified his example slightly to attach the Log writer in the OnCreated partial method for my datacontext.  This again is one of my favorite things about Linq To Sql - everything is a partial class. 

The DataContext.Log gives you the exact Sql Query, which is certainly useful, but it still doesn't help me track down where that query originated from.  So I turned to my DebugTextWriter one more time, and in the TextWriter.Write implementation, I added a StackTrace.  Now I could see the Sql Query followed by the StackTrace which forced that Query.  The code needs some tweaking, since the TextWriter.Write command could be used to simply output a /r/n or even a space, and I don't think we need to generate a callstack just for that..  but this still gives you more than you had to start with.  The code below can be dropped into your project. Just change the Northwind_SimpleDataContext class name to match your DataContext.

public partial class Northwind_SimpleDataContext
{

    partial void OnCreated()
    {
        this.Log = new DebugTextWriter();
    }
    class DebugTextWriter : System.IO.TextWriter
    {
        public override void Write(char[] buffer, int index, int count)
        {
            System.Diagnostics.Debug.Write(new String(buffer, index, count));
            StackTrace trace = new StackTrace(true);
            System.Diagnostics.Debug.Write(trace.ToString());
        }

        public override void Write(string value)
        {
            System.Diagnostics.Debug.Write(value);
        }

        public override Encoding Encoding
        {
            get { return System.Text.Encoding.Default; }
        }
    }

}

 debugout

Above - An example of the Debug Output from the DataContext.Log when using the custom DebugTextWriter above.

So here I am, all ready to test out the blazing performance of the new WebDataGrid.  I set up my million row table, and bind the grid to it... the page loads blazingly fast.  Believe it or not, this has more to do with setting up your table indexes properly than anything else. 

Anyway, paging is working perfectly, and I'm flying through the data.  Then I derailed the train.. I enabled filtering and figured LinqToSql would translate my filtering efficiently, but that doesn't appear to be the case.  I've been digging through SqlProfiler trying to shed some light on the subject.  From the looks of it, the LinqDataSource doesn't convert it's DataView's "RowFilter" string into a sql Where clause.  Instead, it looks like it wants to pull all data down, and then apply a filter.  Either that, or I've been staring at SqlProfiler too long.  I think I'm going to have to get some professional help on this one.  No, not a shrink.. Brad - the SQL Guru.  After all, he built this million row table in the first place.

The WebDataGrid countdown has begun, as we near another volume release of NetAdvantage for ASP.NET.

If you haven't been following, the WebDataGrid is the WebGrid's successor.  It has a brand new architecture, and is built on top of Microsoft's ASP.NET AJAX framework.

The new architecture should be mainly transparent, but if you're the type that likes really tweak and customize things, you'll really appreciate the modular design used for this grid.

Satuday, September 20th, is New England's Code Camp 10.  If you're going to be in the area, you should stop by.  I'm doing a session in the morning where I'll be covering the new WebDataGrid.  I'll go over some of the design aspects of it, as well as discuss where it may differ from it's predecessor. 

I'm going to be working on my presentation this week, which means I'll be dogfooding the WebDataGrid all week, and you can count on hearing about my experiences.  If you're the kind of developer who just has to get a sneak peak, send me an email and I'll see if I can get you a preview build - as long as you promise to give me feedback.  Hope to see you in Boston!

More Posts