Exercise Your LINQ Queries With LINQPad
Here’s a great tool available for free, whether you’re starting out with LINQ for the first time, or whether you’re looking for a better way to write and test your LINQ queries. Written by Joseph Albahari, co-author of C# 3.0 In a Nutshell, LINQPad is a simple visual editor from which you can write LINQ queries against a database and by clicking on a button (or pressing F5) it’ll generate a visual/graphical output of the result. The tool itself is very small (2MB), self-updating and ready to execute (no need to install it). You’ll need to make sure that Microsoft .NET Framework 3.5 is installed before using it. If you have installed Visual Studio 2008 or Visual Studio 2008 Express Edition, then you have what it takes to run the tool.
LINQPad gives you the freedom to use C#, VB or SQL statements to write your LINQ query and offers you the choice between running it against a specific database or not (in case you want to run LINQ with your objects in memory).
For instance, the following screenshot shows you the output from a C# LINQ query:
Specifying a database connection (to target the query against) is very easy if you’re somewhat familiar with setting up database connections in SQL Server. All you need to do is click on the ‘Add connection‘ link on the left pane of the main window and fill in the connection properties. You can also test the connection properties, but there is a twist in the story: you’d expect a message dialog box to pop up telling you whether the connection was successful or not. In reality, the status of the connection is on the window’s title bar. Note that if, for some reason, the connection can’t be established, a message box will appear showing you the cause of the error.
Now you have one less reason NOT to play around with LINQ
Similar posts you might be interested in reading:
- Integrating Enterprise Library 3.1 Configuration Tool in Visual Studio 2008
- Go to your project’s output directory directly by using Windows Explorer as an External Tool (Visual Studio)
- Microsoft’s DreamSpark: free access to .NET development tools for students
- Part II: Setting Up Our Build Server With TeamCity
- Better Modelling with the Visual Studio Class Designer
- My Visual Studio 2008/Resharper Theme
- Launchy: A Good Alternative To The Start Menu