Connecting LINQPad to Dynamics CRM using the Dynamics CRM LINQPad Driver

LINQPad is an invaluable tool for any .Net developer, and it will greatly enhance your ability to write and support applications using Dynamics CRM. There are two ways with which to connect to an instance of Microsoft Dynamics CRM using LINQPad. This two-part article will describe these two different methods and examine the reasons why you might choose one over the other.

Connecting to CRM using the Dynamics CRM LINQPad Driver

NB The CRM LINQPad driver works with CRM 2011 – 2017. It seems as if the connector does not work with Dynamics 365. I have not been able to confirm this myself – if this is the case, you can try the LINQPad 4/5 Driver for Dynamics CRM Web API or create a manual connection as described here.

The LINQPad Driver for Dynamics CRM has been developed by Microsoft’s Premier Field Engineering (PFE) team. It allows you to create a number of predefined connections to CRM, which you can then use in your LINQPad CRM scripts.

The LINQPad driver for Dynamics CRM can be downloaded here, and the (very easy) installation instructions are to be found here.

LINQPad connection definitions persists between sessions, so, providing your credentials do not change, you can use your predefined connections in all subsequent queries.

You can write and run code which utilises the Organisation Service of the connection you are using:

You can easily switch between organisations in your script by simply choosing from the list of available connections:

To help prevent you from accidentally running code against production which should not be run in production, you can mark individual connections as Production and they will display like this:

Not only can you write and execute code using the CRM Driver for LINQPad, you can also explore the entities within the organisation you are connected to:

and explore the composition of entities in detail:

The connector creates a set of Early Bound classes when it is initially set-up and it is therefore possible to write LINQ queries directly against these entities:

and the editor gives you full Intellisense on the entity:

In the second article in this series I will show you how you can manually create a connection to CRM in LINQPad and why you might wish to do this.

Posted in Dynamics CRM, LINQPad | Tagged , | Leave a comment

Leave a Reply