LINQPad FAQ

FAQ Categories

General Use

How do I display the results of multi-statement snippets?

This is explained in the samples inside LINQPad - work through the "5-Minute Induction".

Can I reference custom assemblies and NuGet packages?

Yes - press F4 to add references. The NuGet package manager is available only in the Developer and Premium editions (although in the free edition, you can still execute saved queries that include NuGet references, and restore missing packages).

Can I access internal types of assemblies that I reference?

Certainly. First (in LINQPad 5) go to Edit | Preferences | Advanced, and enable Allow LINQPad to access internal types of other assemblies. (In LINQPad 6 and later, this step is no longer required.) Then, add the following assembly attribute to the project you want LINQPad to access:

[InternalsVisibleTo("LINQPadQuery")]

(LINQPad 5): I'm referencing a custom assembly that reads settings from an application configuration file (app.config). How can I tell LINQPad to use this for my query?

The easiest way is to open the Query Properties dialog (F4) and click the app.config tab.

Alternatively, you can create a file called linqpad.config in the same folder as LINQPad.exe. Anything you put here applies to all queries (unless you override it in the dialog above). Don't confuse linqpad.config with linqpad.exe.config:

  • linqpad.config is for your queries.
  • linqpad.exe.config is for the LINQPad GUI

(LINQPad 6+): My query needs an appsettings.json file. How do I tell LINQPad to use it?

Simply by referencing it: Press F4 and click Add Reference.

Tip: Any non-assembly file that you reference in LINQPad 6 and later is copied to the query's output folder, so you can also reference such things as text files, XML files, and native DLLs.

Can I run multithreaded and asynchronous code?

Yes and yes. LINQPad explicitly supports C#'s asynchronous functions, Reactive Extensions and Microsoft DataFlow. The built-in samples include demos - go to LINQPad Tutorial and Reference > Scratchpad Features > Advanced Features.

Database Querying

Why does LINQPad pluralize table and child association properties? Can I switch this off?

Pluralizing child association properties (while keeping parent associations singular) makes for the most natural queries. You can switch this of by unchecking the "Pluralize" option when adding the database connection. (If the connection has already been created, right-click it to edit the connection properties).

Why does LINQPad capitalize column names? Can I switch this off?

LINQPad capitalizes property names to avoid collisions with C# keywords. To switch this off, uncheck the "Capitalize" option when creating the database connection (or right-click to edit an existing connection).

Why is LINQPad case-sensitive? SQL isn't!

LINQPad's case-sensitivity depends on which language you select in the Language dropdown. C# and F# are case-sensitive, whereas VB and SQL are case-insensitive. (Bear in mind that SQL Server does treat table and columns names case-sensitively if the database has a case-sensitive collation.)

Why does LINQPad use LINQ-to-SQL for querying SQL Server? Why not Entity Framework or EF Core?

LINQ-to-SQL is faster with large schemas, and its cold startup overhead is less than half that of EF or EF Core. This reduces the new query lag, which is valuable when using LINQPad for SSMS-style data exploration tasks. LINQPad's LINQ-to-SQL driver has also been developed extensively over many years, and includes support for stored procedures, table-value functions, multi-factor authentication for SQL Azure, and a full-fidelity SQL log, whose output you can paste into SSMS. You can even query across multiple databases, and query tables from linked servers.

EF Core's strength is that it supports multiple providers, and from LINQPad 6, you can leverage this with the built-in EF Core driver that supports not just SQL Server, but MySQL, Oracle, SQLite and PostgreSQL.

And in all versions of LINQPad, you can query Entity Framework models that you define yourself.

Can I query XML data sources as well as SQL tables?

Certainly. There are built-in samples in LINQPad - go to the 'Samples' tab and expand 'C# in a Nutshell', Chapter 10.

I've bought the LINQPad Premium edition and want to write cross-database queries. How do I do this?

There are two ways to do this. The simplest is the drag-and-drop approach: hold down the Ctrl key while dragging additional databases from the Schema Explorer to the query editor. To access those additional databases in your queries, use database.table notation, e.g., Northwind.Regions.Take(100). The databases that you query must reside on the same server.

The second approach is to list the extra database(s) that you want to query in the connection properties dialog. This dialog also lets you choose databases from linked servers. Here's how to proceed:

  1. Add a new LINQ to SQL connection.
  2. Choose Specify New or Existing Database and choose the primary database that you want to query.
  3. Click the Include Additional Databases checkbox and pick the extra database(s) you want to include. You can also choose databases from linked servers in this dialog.

Autocompletion and Premium Edition Licensing

I understand that a single-user license can activate up to three computers at once. Once I've hit this limit, can I transfer a license from one computer to another?

Yes - you can make up to 6 transfers over a 12-month period (pro-rata for multi-user licenses). To do this, choose 'Remove License' from the Help menu. If you forget, you can remotely deactivate unused machines.

I'm always reformatting and reinstalling Windows. When I reactivate LINQPad's autocompletion, will it eat up an activation?

In most cases, LINQPad won't blink an eye if you keep the same hardware. (If there's any problem, you'll be able to remotely release the old machine's activation).

Can I activate virtual machines?

Sure - right now a single-user license gives you three transferrable virtual activations in addition to your three real activations (pro-rata for multi-user licenses). Virtual activations are locked to both the virtual and host machine, and are valid for Microsoft Virtual PC, Hyper-V, Azure Virtual Machines and VMWare Server & Workstation.

If I buy a 2-user license, will I get 6 activations?

Yes.

I have a team or Enterprise license and want to automate the rollout of LINQPad. Is there any way to activate LINQPad via the command-line?

Yes:

LINQPad.exe -activate=YOUR-ACTIVATION-CODE

Or, to activate all users:

LINQPad.exe -activateall=YOUR-ACTIVATION-CODE

If you are using the LINQPad installer (LINQPadxSetup.exe), you can activate LINQPad as part of installation by calling LINQPadxSetup with the /activate= switch or the /activateall= switch. LINQPadxSetup.exe also supports the /silent switch for automated installation. If you use the /silent switch, you can specify /mergetasks="lprunpath" to instruct the setup to add LINQPad's folder to the PATH environment variable - this is useful if you intend to use the command-line utility (lprun).

My machine has no Internet connectivity. Is there any way to do an offline activation?

Yes, with a few manual steps.

The developers in my company work in three different cities. Are the Team and Enterprise licenses valid over multiple sites?

Yes - you can use a single Team or Enterprise license in up to ten different locations. A location is defined as a usual place of business.

I've lost my activation code. Can I retrieve it?

Click here to retrieve lost activation codes.

Is there a discount for non-profits, churches or charities?

No, with the exception of registered charities that exist to relieve poverty/disease, or to advance human rights, animal welfare, or protection of the environment. These are in general eligible for free licenses - please contact customer support.

Security

I notice LINQPad automatically patches itself when an update is released. How does it ensure updates are authentic and have not been tampered with in transit? My company is anal about security!

Update are RSA-signed, and LINQPad will reject an update without a valid signature.

If I save a connection that uses SQL Authentication, does LINQPad store the password in plain text?

Of course not! LINQPad encrypts the password securely using the Windows Data Protection API.

Customization & Extensibility

What extensibility points does LINQPad provide?

First, you can write extension methods (and any other code that you want to share between queries) in My Extensions (shortcut Shift+Ctrl+Y).

You can also control what fields/properties of your custom types are displayed via LINQPad's Dump method - or take over the rendering entirely - click here for details.

LINQPad also allows you to write custom Data Context Drivers and custom visualizers.

I'm using LINQPad in a presentation. Can I make the query text bigger? And can I use my cordless presenter?

Yes and yes. To adjust the font size, use Control+MouseWheel, or Control+] / Control+[. (You can also adjust your Windows font size - LINQPad is fully DPI-aware.)

To use a cordless presenter, go to Edit | Preferences and in the 'Advanced' tab, enable presentation mode. You can then use the Logitech Cordless Presenter to:

  • Move to the next/previous query in 'My Queries' or 'Sample Queries'
  • Run a query
  • Hide the results window

You can make a query display a PowerPoint slide by entering the following statement into the query:

// Second argument = slide number to start at
PowerPoint.ShowSlide (@"c:\docs\MyPresentation.ppt", 1);

Note that PowerPoint must be installed (the free PowerPoint Viewer is no longer offered by Microsoft). And good luck with your presentation!