Know more about LINQPAD4
Are you new users for LINQPAD4? Then this article will help you to understand basic purpose to use LINQPAD4. LINQ is a client/server application. 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:
• SQL server
• SQL CE 3.5
• SQL CE 4.0
• 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.
• 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.
• You can also test different regular expressions.
• Also there is a provision to test DateTime format string.
• Execution time can be calculated in status bar using LINQPAD.
• Custom visualizers can be written by using LINQPAD.
• 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.