Geeks With Blogs
Frank Wang's inspirations on .NET
IEnumerable<Inspiration> inspirations = from i in DataContext.Inspirations where i.Sharable == true select i

LINQPad lets you interactively query SQL databases in the brand LINQ language. For those who are just started playing with LINQ, this tool is a great way to learn LINQ, and for those who are already familiar with LINQ and use it everyday, it can be used as a nice utility to test/debug your LINQ queries before you put them into your project code.

LINQPad can be downloaded from http://www.linqpad.net/

No installation is required after the download. It's also pretty straightforward to use LINQPad. After you launch LINQPad, go ahead and click on the Add Connection link, and you will be asked to enter the connection string and login.

 

AddConnection

I use the Northwind database as an example here. After LINQPad successfully connects to your database server, it will list all the database objects in a tree view, just like in the SQL Management Studio. Sample LINQ queries are even displayed in the  context menu when you right click on any database object so you can fire a LINQ query right there.

Predefined_Queries

You can certainly write your own LINQ queries against the selected database. If you want to see what exactly is going on behind the scene when you do a LINQ to SQL query, you can switch to the "SQL" tab in the result panel. Usually you can get this valuable information in Visual Studio only when you are debugging your code. It's extremely important see the actual SQL query because the execution of LINQ queries are deferred until you iterate through the result set (IEnumerable<T>) and some times it's just too late to find out you wrote a "bad" LINQ query in your code. With the help of LINQPad, these "bad" queries can be taken out during your development.

SQLQuery

Posted on Friday, March 7, 2008 3:55 PM LINQ | Back to top


Comments on this post: LINQPad - A must-have cool tool for your LINQ programming

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Frank Wang | Powered by: GeeksWithBlogs.net