Skip to content

Dataverse Driver for LINQPad. Helps people connect with Dataverse API easily from LINQPad.

Notifications You must be signed in to change notification settings

joelvaneenwyk/linqpad-driver-dataverse

 
 

Repository files navigation

Dataverse Driver for LINQPad 6+

⚠️ This is a fork of the amazing Dataverse-LINQPad-Driver done by rajyraman (Natraj Yegnaraman).

This new driver is a dynamic driver that uses Microsoft.PowerPlatform.Dataverse.Client assemblies which target .NET 5 and newer. The Tables (Entities) and associated metadata are regenerated everytime LINQPad is opened, so that you don't need to worry about keeping Dataverse Metadata and LINQPad context in sync.

Installing

You can install the driver from LINQPad using NuGet.

1. Click on "View more drivers..."

View more drivers

2. Select "Show all drivers"

From here, search for "Dataverse" and select the driver named NY.Dataverse.LINQPadDrive. Now press Install.

Install

Connecting to your Dataverse Environment

Microsoft.PowerPlatform.Dataverse.Client supports four kinds of authentication:

  1. Application Id/Secret
  2. Application Id/Certificate Thumbprint
  3. OAuth
  4. Azure

After installing the driver from nuget, you can start using this driver by clicking Add Connection link on LINQPad. You will be presented with the dialog below.

Connection Details

The easiest way to connect is to use the credentials you already have in Azure CLI. You can get the currently signed on user in Az CLI using the command below.

az ad signed-in-user show --query "{login: userPrincipalName, name: displayName}" --output table

This should display something like below.

Connection Details

If you choose Azure connection method, you only need to enter the environment URL e.g. https://env.crm.dynamics.com. If you choose any other connection method, you have to enter the appropriate details i.e. AppId/Secret, Certification Thumbprint etc.

Running LINQ Query

After entering the required details on the connection dialog, the context would be generated and you should see all the tables on the left hand side.

Tables

You can either write a new LINQ query on the query window, or right click on the table name, to see some quick suggestions.

Query Options

LINQPad has a whole bunch of samples on how to craft your LINQ queries, in case you don't know how to query in LINQ and want to learn the syntax. LINQ is very similar to SQL in syntax, but more powerful than SQL.

Samples

I have also given five samples that illustrate the power of LINQPad and how you can use the driver to query Dataverse.

Dataverse Sample

I highly recommend that you purchase LINQPad Premium, as you get both Intellisense and Debugging capability. It is great for quick PoCs and experimentation. I currently get a free Premium license as a Microsoft MVP, but I had paid for Premium license even before I became a Microsoft MVP.

Calling Dataverse API

You can use DataverseClient property to access the ServiceClient object. Once you have access to this object you can then basically do any operations that are supported by the client.

Dataverse Client

Getting FetchXML/WebAPI URL from LINQ

If you click on the SQL tab, you can see both WebAPI URL and FetchXML that correspond to the LINQ query that you ran.

LINQ to FetchXML

Thank You

About

Dataverse Driver for LINQPad. Helps people connect with Dataverse API easily from LINQPad.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages

  • C# 100.0%