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 access internal types of assemblies that I reference?
Certainly. First, go to Edit | Preferences | Advanced, and enable 'Allow LINQPad to access internal types of other assemblies'. Then, add the following
assembly attribute to the project you want LINQPad to access:
I'm referencing a custom assembly that reads settings from an application configuration file (app.config). Where
should I put my application config file so that LINQPad queries will pick it up?
Create a file called linqpad.config in the same folder as LINQPad.exe and put your configuration data there.
Don't confuse this with linqpad.exe.config:
- linqpad.exe.config is for the LINQPad GUI
- linqpad.config is for your queries.
Why does LINQPad pluralize table and child association properties? Can I switch
Pluralizing child association properties (while keeping parent associations singular)
makes for the most natural queries and is what Visual Studio does by default
in building typed DataContexts.
To switch off pluralization, uncheck 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. If you want case-insensitivity, choose 'VB' instead of 'C#' (and then
remember the underscores with multi-line queries). On a tangential point, SQL Server
does treat table and columns names case-sensitively if the database has a case-sensitive
Why does LINQPad use LINQ to SQL under the covers, rather than Entity Framework?
LINQ to SQL is faster with large schemas and in most cases, emits better SQL. You can, however, use EF with
EDMs that you define
yourself. For querying SQLite, MySQL and Oracle (via the optional plug-in), LINQPad
uses Matt Warren's IQueryable toolkit.
Can I query XML data sources as well as SQL tables?
click here for a simple example. There are a whole lot more examples in
the "Samples" tree, under C# 5.0 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.
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
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
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?
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?
Or, to activate all users:
If you are using the LINQPad installer (LINQPad4Setup.exe), you can activate LINQPad as part of installation by
calling LINQPad4Setup with the /activate= switch or the /activateall= switch. LINQPad4Setup.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.
I live in a country that doesn't support PayPal (Nigeria, Iran). What do I do?
The payment page now allows you to pay directly via credit card (without PayPal). If
you still experience difficulties, please contact customer support.
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!
LINQPad will accept an update only if the assembly has a valid signature - and the
public key matches that of the original assembly.
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
Customization & Extensibility
What extensibility points does LINQPad provide?
First, you can reference custom assemblies and import custom
namespaces - go to Query Properties (F4).
You can also control what fields/properties of your custom types are displayed via
LINQPad's Dump method, by implementing the following interface:
public interface ICustomMemberProvider
// Each of these methods must return a sequence
// with the same number of elements:
Note that you don't have to reference the LINQPad assembly in order to implement
this interface. Instead, you can copy and paste this interface definition into your
target application - as long as it's defined in the LINQPad namespace, LINQPad will
recognize the interface via "duck-typing".
If your custom type has only one property that you want to expose, GetNames/GetTypes/GetValues
should each return a single-element array or sequence. If you make the single element that GetNames
returns an empty string, LINQPad will "collapse" the type into the value.
LINQPad also allows you to write custom Data Context Drivers and
Will LINQPad let me run multithreaded code and Parallel LINQ Queries?
Yes. LINQPad also explicitly supports C#'s asynchronous functions, Reactive Extensions and Microsoft DataFlow.
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+Plus /
Control+Minus. (You can also adjust your Windows font size - LINQPad is fully
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
- 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 you must install the
PowerPoint Viewer for this to work (even if you have already installed
the full-blown PowerPoint). And good luck with your presentation!