Header Ads

Introduction of LINQPad

LINQ :

LINQ is a Language Integrated Query it enables, we can access all datasource with C# expression. If you want to know more about Linq,Already I have explained this article - LINQ
 
LINQPAD :

LINQPad compiles queries using .NET's CSharpCodeProvider (or VBCodeProvider). LINQPad's engine runs in a separate application domain.

How to create connection? 

In left pane, click on "Add connection and choose Data context". Default is LINQ to SQL. Click on next. You will get LINQ To SQL Connection screen. You can choose provider from following:

1. SQL server
2. SQL CE 3.5
3. SQL CE 4.0
4. SQL Azure

I have chosen SQL server for demo purpose. Then choose logon details as windows authentication or SQL server authentication. Choose Database "Display all in treeview". (If you choose then then you will get list of all tables in tree view structure)

You can also browse and attach database file. You can check or uncheck user instance checkbox.

There is one more option to specify new or existing database. You can create database as well.

There is option that you can include additional databases. Similarly you can include system views ans SPs. You can choose Data Context Options as per your requirements. You can use SSL for security purpose.

There is test button to test newly created connection. You can check the checkbox to remember this connection. Click on "OK".

How to build EF model through your LINQPAD? 

Building EF model in dll or exe is very easy. Model database has to be public and you have to point to correct assembly so build your application to get dll or exe and then use LINQPad in order to load your model. There is a browse button to select custom assembly. Once your EF model is ready, you can write all the queries against the EF model.

        1.Advantage of this is LINQ developer can be ready with LINQ queries and those can be tested separately out of your actual .Net application. You can repair/modify and retest it as well. It becomes very easy for maintenance.
2.You can also test different regular expressions.
3.Also there is a provision to test DateTime format string.
4.Execution time can be calculated in status bar using LINQPAD.
5.Custom visualizers can be written by using LINQPAD.
6.You can also refer to NuGet references along with custom assemblies.

In query window, you can select your language from C# expression,C# statements, C# programs, VB expression,VB statements, VB programs, SQL, ESQL,F# expression, F# program. You can also change connection from dropdown.

No comments:

Powered by Blogger.