04 September 2007

Cool LINQ Utility

Like a lot of you out there, I've been spending a bit of time learning the new Language Integrated Query (LINQ) features available in the .NET Framework 3.5 (still in beta).  LINQ provides some very powerful capabilities for querying not only databases but other data types as well (e.g. XML, .NET collections, arrays, etc.).  Although the syntax is similar to SQL, it is not exactly the same which offers a bit of a learning curve.

I came across a utility called LINQPad a few days ago that has been helping me get over the learning curve with LINQ.  This utility offers functionality similar to the query functionality in SQL Enterprise Manager.  You create ad-hoc queries using the LINQ syntax and view the results in a hierarchical format (where applicable).

There is an interesting challenge on the LINQPad site that goes as follows:

  • Locate the shortcut for SQL Management Studio on your Start Menu and move it some place else.
  • In its place, insert a shortcut to LINQPad.
  • For the next week, perform all your ad-hoc SQL queries using only LINQPad.

I'm currently about 2 days into the challenge and I have to say that it's a completely different mindset.  I also have to admit that I've cheated at least once and used SQL Enterprise Manager to run some queries because I was under a time crunch and didn't have the time to figure out exactly how I could use LINQ to achieve a particular problem.  However, I suspect that after another week or so I should have a very good understanding about the LINQ syntax (at least for database queries).

You can download and read more about LINQPad here.  Also, here are a couple of good LINQ reference sites for anyone starting out with LINQ:

2 comments:

Schawaska said...

I cant wait to the final release, so we can start developing production applications with LINQ.
Nice blog btw.

Unknown said...

You won't have to wait long. It was announced this week that VS 2008 will be released by month's end. VS 2008 Beta 2 does have a "Go Live" license so you could (if you wanted to) start developing LINQ code today and it should work just fine with the RTM version due out within the next couple of weeks.

Post a Comment