LINQPad- A tool for the automation of Linq queries
This article is related to the tool "LINQPad" which is used to create and validate the Linq queries. In this article, I will explain about- from where to download the tool, What all the options in the tool to perform the operations, How this tool is useful in creating the complex Linq queries and optimize the performance and productivity.
Hai Friends,
As a .Net developer, you might have come across many hurdles in the programming where we face lot of complications in writing the code. Also as the technology improves, we get the trouble to learn always new things to update ourselves and be in the industry.
Now days when the version of Visual Studio are getting released almost every year and additional to that the Microsoft is releasing the add-on technologies, we are facing many issues in the implementation. One of the issues is creating Linq query. If the Linq query is for one table, happily we can write with no issues. If we added one more table to the existing one, we can still perform the operations and write it with some difficulties. But if there are 7-8 tables or even more and with that many joins, it's very difficult to write such a big Linq query as we don't have any UI tool to test whether it's working partly or fully.
There is a tool called LINQPad which will take care of your hurdles in writing big Linq queries.
In this article, I will explain about the tool, how and from where you can download this tool and then how to use it in proper way so that tomorrow if you want to write such a big Linq queries, easily you can write it.
Our steps will move from the downloading and till the creation and execution of the Linq query using the editor.
Download the LinqPad: The LINQPad can be downloaded from the website http://www.linqpad.net/
1. Go to the website: http://www.linqpad.net/
2. Click on the link, it will start downloading. Here either you can save or you can directly run.
3. In the right corner of the website, we can see the link "Download now".
4. The below screen will appear.
5. Click on Run button.
6. Click on Next, series of windows will appear. Just click on Next till install
7. Click on Install. The installation will complete in less than 30 seconds.
8. Click on Finish button.
9. Below window will appear:
10. Click on Add connection link to connect with the database. It will ask to choose the DataContext. We can use default Linq to SQL or if we are working with Entity Framework then we can choose the Entity Framework data context etc.
11. If we choose default Linq to SQL then it will ask that which database you want to connect for the Linq to SQL.
12. We can choose all our details, Server name, Authentication Mode etc. We can test here whether our entries are correct for connection or not. Click on Test and you should get the Message “Connection Successful" as below:
13. Now click on OK.
14. In the left pan, we can see that our LINQPad is ready with all the Database objects like Tables, functions, stored procedure etc.
15. In the Right Pan, we can see many options:
a. The first option is to run the query.
b. The Language Option: To choose the language in which you want your query should be generated.
c. Connection Option: Which database connection do you want to use for this query. So we can select the database from the connection drop-down list.
16. Right lick on the Database from the left pan and then click on New Query:
17. A new query window will be generated.
18. Write some sample query in the right pan
19. Press F5 or the green button to execute. Check the result as below:
20. We can see that how perfectly it's working. Here we got the result like Split the string and then give me the result in an order.
21. We can use as many tables as we want to generate the complex Linq queries.
22. We can see the other options in the below pan.
23. Lambda code, SQL code as well as the IL(intermediate Language) or MSIL or CIL for the above query.
24. In the left pan below, we can see there are many samples they have provided for the Linq.
I hope this article will remove your fear on the Linq.
This is the article is useful..thanks for posting