Pages

Sunday, 28 July 2013

How to use LINQPad

 

Introduction

Querying is merely a special case of using LINQPad. More generally, LINQPad is a C#/VB/F# scratchpad that instantly executes any expression, statement block or program with rich output formatting and a wealth of features that "just work". Put an end to those hundreds of Visual Studio Console projects cluttering your source folder and join the revolution of LINQPad scripters, testers, and incremental developers. Reference your own assemblies and NuGet packages. Script in your favorite .NET language with optional autocompletion and the entire .NET Framework at your fingertips. Experience the magic of dynamic development and instant feedback in the ultimate programmer's playground!

Language-Integrated Query (LINQ) is a set of features introduced in Visual Studio that extends powerful query capabilities to the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store. Visual Studio includes LINQ provider assemblies that enable the use of LINQ with .NET Framework collections, SQL Server databases, ADO.NET Datasets, and XML documents.

You can download LINQPad from here http://www.linqpad.net/.

The steps we follow how to use LINQPad

Open the LINQPad and add new connection

clip_image002

Click on Add Connection then open the new connection wizard select Default (LINQ toSQL) and click the Next Button.

clip_image004

Enter the Server Name. Here we can mention the authentication type also

clip_image005

Specify New or existing Database

clip_image006

Select the Database name here

clip_image007

After that we can test the Connections

clip_image008

Now it’s showing all the database tables here clip_image010

We can select the different Languages from here

clip_image012

Simple Select query and execute

clip_image014

Now we need to select the C# Statement(S)

clip_image016

Write a simple select query and for execute the query we need to use the .Dump() command.

clip_image018

After that we can run the query

clip_image020

Right click on the table we have get some more inbuilt query options

clip_image022

The Samples tab has more examples for efficient LINQ queries

clip_image024

Reference

http://www.linqpad.net/.

No comments:

Post a Comment