NY.Dataverse.LINQPadDriver 1.7.5

dotnet add package NY.Dataverse.LINQPadDriver --version 1.7.5
NuGet\Install-Package NY.Dataverse.LINQPadDriver -Version 1.7.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NY.Dataverse.LINQPadDriver" Version="1.7.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NY.Dataverse.LINQPadDriver --version 1.7.5
#r "nuget: NY.Dataverse.LINQPadDriver, 1.7.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NY.Dataverse.LINQPadDriver as a Cake Addin
#addin nuget:?package=NY.Dataverse.LINQPadDriver&version=1.7.5

// Install NY.Dataverse.LINQPadDriver as a Cake Tool
#tool nuget:?package=NY.Dataverse.LINQPadDriver&version=1.7.5

Dataverse Driver for LINQPad 6

The original LINQPad Driver for Dynamics CRM (as Dataverse was known back then) was written by Kenichiro Nakamura. It used the SOAP endpoint along with CrmSvcUtil to generate the early bound classes needed to show the entities in LINQPad. It was a static driver, meaning that you had to regenerate the context if you had new metadata e.g. new fields, entities etc.

This new driver is a dynamic driver that uses Microsoft.PowerPlatform.Dataverse.Client assemblies which targets .NET 5. 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 from nuget. Click on View more drivers, and then choose "Show all drivers". Search for Dataverse and you should be able to see the driver and install it.

<img src="images/newconnection.png" alt="View more drivers" />

<img src="images/install.png" alt="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.

<img src="images/connection%20details.png" alt="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.

<img src="images/Az%20CLI.png" alt="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.

<img src="images/entities.png" alt="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.

<img src="images/queryoptions.png" alt="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.

<img src="images/samples.png" alt="Samples" />

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

<img src="images/dataverse%20samples.png" alt="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 licence as a Microsoft MVP, but I had paid for Premium licence 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.

<img src="images/dataverseclient.png" alt="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.

<img src="images/linq%20to%20fetch.png" alt="LINQ to FetchXML" />

Thank You

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.5 363 11/14/2023
1.7.4 179 10/4/2023
1.7.3 952 9/9/2022
1.7.2 598 4/30/2022
1.7.1 441 12/3/2021
1.7.0 313 12/3/2021
1.6.9 412 10/25/2021

Update Azure Identity (1.10.4) and Dataverse Client (1.3.0) packages