LINQPad FAQ
FAQ Categories
Non-Technical
Who wrote LINQPad?
LINQPad is written and maintained by Joe Albahari, author of C# in a Nutshell.
Joe is a long-time conference speaker, and has received 15 Microsoft MVP awards.
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. Just add the following assembly attribute to the project you want LINQPad to access:
[InternalsVisibleTo("LINQPadQuery")]
In LINQPad 6+, this is all you need to do. In LINQPad 5 and earlier, you'll also need to go to Edit | Preferences | Advanced in LINQPad and enable Allow LINQPad to access internal types of other assemblies.
(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.
(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
Can I run multithreaded and asynchronous code (async/await)?
Yes and yes. LINQPad explicitly supports C#'s asynchronous functions, Reactive Extensions and Microsoft DataFlow.
The built-in samples include demos - press Ctrl+F1 and search for threading or async.
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, and minimizes potential conflicts with .NET type names.
You can switch this off 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.)
LINQPad lets me choose between LINQ-to-SQL and EF Core when querying SQL Server. Which is better?
(Note that LINQPad 6+ uses a special enhanced version of LINQ-to-SQL.)
LINQ-to-SQL is faster with large schemas, and its cold startup overhead is less than half that of 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 not just SQL Server, but MySQL, Oracle, SQLite and PostgreSQL. Also, if you
need complete compatibility with EF Core's features and abilities, it makes sense to use this driver.
With EF Core, you can also query Entity Framework models that you define
in Visual Studio.
Can I query XML and JSON data sources as well as SQL tables?
Of course, and there is special support for visualizing XML and JSON data. Take a look at LINQPad's built-in samples - 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:
- Add a new LINQ to SQL connection.
- Choose Specify New or Existing Database and choose the primary database that you want to query.
- 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.
Pro 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
a LINQPad license, 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.
Employees working from home are excluded from the location count.
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 and Privacy
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!
Updates are fetched over HTTPS and are RSA-signed. LINQPad will reject an update without a valid signature.
LINQPad's update and licensing servers are hosted on Microsoft Azure, following best practices, with multi-layer security.
What information does LINQPad collect?
This is covered in the EULA.
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!