Partager via


StreamInsight LINQPad Driver

Joseph Albahari's LINQPad has become an indispensable tool for many of us on the StreamInsight team. It allows you to quickly design, test and visualize results for LINQ queries. We've now developed a dedicated LINQPad driver for StreamInsight with Joe's help that you can use to quickly explore temporal data and StreamInsight's temporal LINQ dialect!

To get started, install .NET 4.0LINQPad 4.0 and StreamInsight 1.1. You'll need the full version of StreamInsight (StreamInsight.msi, not StreamInsightClient.msi) and you'll need to create a server instance during setup. This version of the LINQPad driver evaluates stream queries locally with an embedded StreamInsight instance. I strongly recommend activating auto-completion in LINQPad -- requires the purchase of an activation code but well worth the price! 

After launching LINQPad, you'll first need to register the StreamInsight driver:

  1. Click "Add connection"
  2. Click "View more drivers..."
  3. Click "Download & Enable Driver" under the "Microsoft StreamInsight Driver" heading

To create a connection to the embedded StreamInsight instance, click "Add connection" and select the "Microsoft StreamInsight" context option. For now, just select the "Default Context" option from the "Context Kind" list. Drag the newly created "StreamInsight: Default Context" connection to the query pane or select it from the "Database" list to write a query against a blank-slate context with no built-in streams. You can introduce a data source inline as in the following example that uses the "C# Statement(s)" language option in LINQPad:

 var source = new[]
{
    PointEvent.CreateInsert(new DateTime(2011, 1, 1, 12, 0, 0),
                            new { ID = "Hello" }),
    PointEvent.CreateInsert(new DateTime(2011, 1, 1, 13, 0, 0),
                            new { ID = "World" }),
};

var input = source.ToStream(Application,
                            AdvanceTimeSettings.IncreasingStartTime);

input.Dump();

Hit F5 or click "Play" to run!

In addition to the default context, "Performance Counter" and "Hitchhiker'sGuide" contexts are available. The former context allows you to author queries against live performance counter streams. The latter exposes the data explored in A Hitchhiker's Guide to StreamInsight Queries. In addition, we have created a small set of samples -- this set should expand over the next few months! -- that rely on built-in contexts described above. You can add these samples by clicking "Download more samples..." under the "Samples" tab in LINQPad and choosing “Microsoft StreamInsight Samples”. The samples cover:

  1. Queries from the Hitchhiker's Guide
  2. Some simple performance counter queries to get you started
  3. An introduction example using the default context that illustrates various options for displaying StreamInsight query results

In a future blog post, we'll describe how you can author custom StreamInsight query contexts. As always, let us know if you have any questions or comments!

Regards,
The StreamInsight Team

Comments

  • Anonymous
    November 24, 2010
    Works beautifully!  Well done.

  • Anonymous
    January 07, 2011
    We are behind a firewall which prevents us from downloading the driver through linqpad, is there any alternative ways of getting the driver? Thanks, Atul

  • Anonymous
    January 13, 2011
    Yes. Where can we get the driver outside of LINQPad?

  • Anonymous
    January 23, 2011
    try to download and add manualy the plugin www.linqpad.net/.../datacontextdrivers.aspx