Skip to content

LINQPad

Steve Ives edited this page May 18, 2020 · 3 revisions

Harmony Core Logo

LINQPad and OData Services

LINQPad is described on its web site as "The .NET Programmer’s Playground" and some of its features are listed as:

  • Instantly test any C#/F#/VB snippet or program
  • Query databases in LINQ (or SQL) — SQL/Azure, Oracle, SQLite, Postgres & MySQL
  • Enjoy rich output formatting, optional autocompletion and integrated debugging
  • Script and automate in your favorite .NET language

In addition to this, LINQPad 5 (see below) has an OData 4 plugin available which allows developers to connect to an OData 4 service and execute LINQ queries directly against the service.

NOTE: There are currently two versions of LINQPad available. LINQPad 5 is a .NET Framework application that has an OData 4 plugin. LINQPad 6 is a newer .NET Core-based version that does not yet appear to support an OData 4 plug-in.

To get started:

  1. Install and start LINQPad 5.

  2. Click on the Add connection link in the upper-left corner to display the Choose Data Context dialog.

  3. The first time in you will need to download and install the OData Plug-In

    • Click the View more drivers... button.
    • Scroll down and locate the OData V4 Driver, then click the Download & Enable Driver link.
    • You should see a dialog confirming that the driver was installed. Click OK to dismiss the dialog.
  4. Back in the Choose Data Context dialog, select the OData 4 driver then click the Next> button.

  5. In the OData 4 dialog, enter the URL to the base of your service (usually http://localhost:8086/odata/v1 for development services), then click the OK button.

There will be a short delay while the program contacts your service, and downloads and parses the OData metadata, then it should display a list of your entities in the upper-right side.

  1. Right-click on one of your entities, say Customers, and select one of the pre-configured LINQ expressions, perhaps Customers.Take(100).

You should now see data appear in the main body of the application. Notice there is a control above the data where you can edit the LINQ query in order to execute other functionality.

OData in LINQPad 5

Clone this wiki locally