LINQPad 4 Driver for Dynamics CRM is available on CodePlex

I am pleased to announce that we released “LINQPad 4 Drive for Dynamics CRM” on CodePlex.

What’s LINQPad?

LINQPad (http://www.linqpad.net/) is a great tool which you can write and execute LINQ query against many data sources, like SQL Server, Oracle or Web Services. In addition to LINQ query support, the tool also supports C#/F#/VB expression, statement block or program, to write and execute the code and code snippet.

What can you do with CRM Driver?

By using CRM Driver, you are able to run LINQ query against Microsoft Dynamics CRM organizations on the fly. Follow the steps below to try it out!

4. Then it automatically start loading metadata and DataContext from selected organization. Wait until it’s done.

5. Once “Loading Data” completed, click “Exit”. Then LinqPad starts loading schema, which takes a bit of time. Wait until you see schema information on the left pane like below screenshot.

Write LINQ query and Execute

1. Firstly, select added connection from “Connection” dropdown on the top right.

2. Enter following query to query window.

3. Click “Play” button or press F5 key to execute query. You will see the result in result pane.

4. Click SQL tab in result pane, where you can find QueryExpression and FetchXML equivalent to LINQ query.

Write C# statement and Execute

In addition to LINQ query, you can write C# as well.

1. Click [+] tab to open new query window next to existing Query tab.

2. Select “Connection” again.

3. Select “C# Statement(s)” from Language dropdown.

4. Enter following statements and Execute.

“this” of above statement represents DataContext of your connection, which is CrmOrganizationServiceContext. Therefore “this” has all common method from OrganizationService, as well as methods from OrganizationServiceContext.

IntelliSense?

When you use free version of LINQPad, you won’t get IntelliSense, but if you purchase the license, it works like Visual Studio.

What’s next?

We would like to hear feedback from you!! As it’s open source, you are able to extend it to your own needs, or you can suggest/report bugs.

There is a limitation though. When one tries to connect to orgs which have Unified Service Desk (USD) solutions installed, the connection/read process fails due to the way the USD entity schema is built.

Thanks Kenichiro, a much needed driver/addition to LinqPad! I was using an older tool for CRM 2011, which wasn't upgraded to support the new versions. This has already saved me a lot of time and will definitely make testing a lot easier going forward.

I'm attempting to try this driver out. We're On Premises with CRM 2011. I enter path to server http://crmsrv/ABCCorp Port 80 and Auth = AD and Use Default Credentials..

When I attempt to connect I get message "An Error occurred while processing the login request. View Error Log" But when I click log link I get "Cannot find log Login_ErrorLog.log Do you want to create".

Cant get this to work with O365 account with our company domain creds (federated). I get an error message and have tried the proxy config settings which worked for plugin registration tool but no luck. Any suggestions?Thanks

Ken,
Thank you for the update. I am afraid the driver has stopped working, probably after a LINQPad update. Queries won’t complete (LINQPad keeps “Executing…” for minutes even for very simple queries).

Oddly enough, I can see the query converted to QueryExpression and FetchXml in the SQL pane, looks like those Requests are executed just fine (I assume those are QueryExpressionToFetchXmlRequest and FetchXmlToQueryExpressionRequest, are they?).

I am experiencing the same issue as described by Roberto Collina: Queries won’t complete (LINQPad keeps “Executing…”).
I have narrowed it down to queries that return entities won’t complete. If I change the return type to a property on a entity, it executes as expected.
I am running v. 4.57.02.

Thanks for your comment.
This is because there is field and relationship name duplicate. It’s more USD side of issue not LINQPad Driver, but this is bit tricky to workaround as we don’t have control for it. Workaround I can think of is to omit relationship generation…

Unfortunately not. The thing is that Entity becomes a class and attribute/relationship becomes properties. When field and relationship has same logical name, then this duplicate error happens. If this is your own custom entity, please consider changing logical name if possible.

Thought you’d say that 😉
I understand the issue – means we’ll have to drop an existing relationship between entities and rebuild – not easily doable on a production system without a fair amount of work.
Thanks for the reply and thanks for the driver which saves us so much time in all of our other organisations apart from this one.

I have the same issue as Roberto Collina below. The connector installs fine and I can see entity list. c# expressions (who am i request) work fine. But really simple linq expressions (from a in AccountSet select a) get stuck in ‘Executing’. Very occasionally a query returns a result in next to no time, but the next time I run the same query, it gets stuck again.

Unfortunately, I cannot use this because the Unified Service Desk has a couple of entities that contains fields with the same name. After connecting to the org and while loading the entity data, it crashes claiming it already has a definition for a column.

I am trying to use the REST driver with CRM 2011 but can’t add an on-premise connection.

I set the server name and port and can get the list of available organizations but I get a System.ArgumentException of “Invalid authenticate header format. Parameter name: authenticateHeader”.

One difference from the instructions above is that the CRM login page has a tick box that is selected by default that says “Register to Azure AD automatically. If app is already registered, reusing it.” Un-ticking the box prompts for a ClientId. I’m not sure what this should be set to for on-premise.

Pazu2 asked “How do you write relations”. For a linked entity, I just referenced the field that represented the link and it worked, yet I do not see that field/link in the SQL tab Query Expression or FetchXml.

I was wondering if there is a way to change the OrganisationService.CallerId after connecting with the CRM driver.
I can do this in c# in (say) a c# unit test, but can’t work out how to do this in LinqPad with the driver.
Any ideas?