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 ( 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!

Install Driver to LINQPad

1. Download and install LINQPad if you don’t have it yet from

2. Go to and click “DOWNLOADS” tab, then download CRMLinqPadDriver.lpx file.

3. Open LINQPad and click “Add connection” link on top left.


4. Click “View more drivers…” button at the bottom of the page.


5. Click “Browse” button in the bottom of the page.

6. Select downloaded CRMLinqPadDriver.lpx file, then click “Open”.

7. Click OK.


Use the Driver

1. Select “Dynamics CRM Linq Pad Driver” in Choose Data Context and click “Next”.


2. Click “Login to CRM” button.


3. Login to your Organization at login screen.


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.


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.

Premier Mission Critical/Premier Field Engineer 
Microsoft Japan

Comments (46)

  1. Pazu2 says:

    1) How do you write relations ? They are displayed in Tree, but normal dot syntax does not work for me.

    2) Does it mean that Linq2CRM is somewhere on Codeplex too ?

  2. Thanks for your comment.

    Firstly, as my code is hosted on codeplex as open source, you can check and give suggestion to me if there is something i can do.

    Secondly, i do not know about Linq2Crm.


  3. Michael Mayo says:

    Awesome to see LinqPad 4. This is my Linq/C# Management Studio!

  4. sidney says:

    Nice tool and extension. It makes my work easier 🙂

  5. Prometheus says:

    Great tool. I use it all the time.

    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.

    Are there any updates planned to the plugin that can help with this?


  6. Rod McBride says:

    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.

    Keep up the great work!

  7. Prometheus,

    I will check the USD issue as soon as possible.

    Sidney and Rod,

    Thanks for your comment and I appreciate it. We are working on PowerShell project now and will be posting information soon.


  8. Curtis Broyles says:

    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".

    Any assistance would be appreciated.

  9. Thanks for your comment.

    Please make sure you enter crmsrv as server name, uncheck use SSL, 80 for port.

    Also try to explicitly provide credential just in case.

  10. Curtis Broyles says:

    I got it to work.  Before in server box I had been using http://crmsrv or http://crmsrv/ABCCorp.

    I entered only crmsrv and it worked like a charm.

  11. Bruce says:

    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

  12. Thanks Bruce,

    It's working in my environment, which also federated to my corp AD FS. Where do you see the crash? Even before listing all organizations or while downloading metadata?

  13. Sandro Alvares (KingRider) says:

    An error has occurred:


    Not found a file users/…/AppData/…/DataContext.cs ? where a download

  14. Hi Sandro,

    The file is auto generate one so it indicate that failed to create metadata from the crm instance.

    Could you delete the connection and retry ?

  15. Roberto Collina says:

    Thanks for the driver, any chance to get this working for LINQPad 5 as well?

    It seems there are some issues with referenced assemblies.

    1. new version of LINQPad driver released, which works with LINQPad 4 and LINQPad 5. Thanks.

      1. Roberto Collina says:

        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).

        1. Thanks for feedback. It’s working in my environment, so could you let me know exact linq query you are executing?

          1. Roberto Collina says:

            Thanks for your reply, Ken.

            from c in ContactSet where c.FullName == “Roberto Collina” select c

            I took a screenshot of the callstack:

            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?).

          2. Roberto Collina says:

            Hello Ken,
            I believe my last message was either removed or caught by a spam filter.
            Did you have any chance to see it?

          3. Sorry I just saw that. It’s actually caused by underline SDK and we need to do like select new {}

          4. DrJonesDk says:

            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.

          5. Yes, I have same issue and it looks like its SDK level of issue. Please select columns explicitly to avoid the issue.

  16. Prometheus says:

    Received exception when pulling MetaData for org that has USD installed.

    “Cannot compile typed context : The type ‘Microsoft.Pfe.Xrm.msdyusd_task’ already contains a definition for ‘msdyusd_ShowTab’ (line 169419).

    Any idea on how to get around this?

    1. 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…

      1. Prometheus says:

        Thank you for your response. How would I skip relationship generation in LinqPad?

  17. Jagannath says:

    Cannot compile typed context: The type ‘Microsoft.Pfe.Xrm.mcs_task’ already contains a definition for ‘mcs_ShowTab’ (line 260562)

    What is the solution for this am? I am getting these when i try to login.

    1. This is due to property name conflict. You should have same name for field and relationship. Same name cannot be co-exist in a class in C#.

    2. BenHWalker says:

      Same issue here with duplicate attribute/relationship name. Any news from Microsoft on this?

      1. 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.

        1. BenHWalker says:

          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.

          1. I understand that it is not easy or even impossible to change schema name. I will think about adding feature to let you select if you need or don’t need relationship later.

  18. BenHWalker says:

    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.

    1. Roberto Collina says:

      Glad I’m not the only one!
      Afraid I don’t have a solution, waiting for a reply from MS.

  19. Jose Kercado says:

    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.

  20. You guys are right about this. It requires to use select new {} format, rather than just select a. It works with Web API version though, If you have CRM2016, please try Web API driver instead.

  21. robingod says:

    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.

    I’d really like to use linqpad but can’t get it working!

  22. Dennis says:

    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.

    1. Thanks for your comment.
      Please give me sample query you are running so that I can repro it.

  23. BenHWalker says:

    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?

  24. Prometheus says:

    Is there support for CRM 365 orgs? I’m seeing errors trying to connect with the driver.

    1. Peter says:

      I can confirm that. After selecting the org in the login dialog, it comes with another dialog to select an org again, but the list is always empty and the dialog can only be canceled.

      1. Please use Web API version for D365.

    2. Please use Web API version of the driver.

Skip to main content