Up Test, log, and debug

DevForce LINQPad driver

Last modified on July 30, 2013 17:57

The DevForce LINQPad driver allows you to use LINQPad with a DevForce model. 

In response to customer requests, we’ve built a DevForce LINQPad driver that lets you use LINQPad with DevForce models. There's no need to struggle with the EF or Universal drivers or add namespaces and assemblies.

The DevForce LINQPad driver adds everything for you, so you can get started using LINQPad with your DevForce model right away.


Download 

Install the DevForce driver

  1. NEW The DevForce LINQPad Driver is now a featured driver in LINQPad.  This means that you don't need to directly download the driver file and can skip to step #4 below.
  2. For Internet Explorer:  Extract the .lpx file from the zip download.  For other browsers, download the .lpx file directly.
  3. Copy the .lpx to a folder on your hard drive.
  4. Open LINQPad
  5. Click Add connection.

    linq1.png


    The following dialog is displayed:


    linq2.png

  6. Click View more drivers….

    viewdrivers.JPG

    Scroll through the list of featured drivers until you find the DevForce LINQPad Driver.  Click the Download & Enable Driver link to install the driver.  

    Alternately, to install a downloaded .lpx file, click the Browse..."* button to browse for the DevForceLINQPadDriver.lpx file you copied above.

  7. Once installed, the driver is available in the LINQPad Choose Data Context dialog:

    linq4.png

Use the DevForce LINQPad driver

  1. Select the driver from the Choose Data Context dialog. (shown above)

A dialog collecting the model assembly, sub-typed EntityManager name and .config file opens:

linq5.png

2. Browse to the .NET assembly holding your EDMX or Code First model. (In a Silverlight application, be sure to point to the .NET assembly, not the Silverlight assembly.)  After selecting the assembly, the EntityManager type name and .config file boxes will be automatically filled in if the appropriate information was found.  If not, select the Choose or Browse options.  

linq6.png

Once selected, you will see your EntityQuery properties in the left pane.  You can drill in to see the properties for the entity.

linq7.png

3. To see if the driver and model loaded successfully, try a simple query. Right-click an EntityQuery and choose the Take(50) sample query. Then run it:

linq8.png

Getting started

  • Click the Use … link in the upper right to tell LinqPad that you want to reference the model assembly.
  • The button with the green arrow executes your code; F5 is the shortcut key.
  • Pick Language: C# statements if you want to evaluate multiple statements (terminated with ;). 

The C# statement(s) option allows you to do several queries in one go. Note the assignments to a variable named x and the Dump() call.


samplequery.JPG

  • Pick Language: C# expression if you’re only trying a single query (don’t terminate with ; and don’t assign to variables).


    queryexpression.JPG

  • You can use either comprehension or method syntax: whichever suits you.
  • VB expressions, statements and programs are supported too!
  • You'll notice that you don't need to create an EntityManager, as LINQPad does that for you.  Each query tab is effectively an EntityManager, letting you execute the usual EntityManager queries and methods. (Yes, you can call SaveChanges and other methods too, but we can make no guarantees about what may work in the LINQPad sandbox.)  
  • All queries by default use the DataSourceOnly query strategy.  LINQPad creates a new EntityManager each time a query tab is executed, so caching is unnecessary. 
  • DevForce probing is performed using the folder holding the model assembly.  This may have unexpected consequences, especially if your custom IEntityLoginManager is found.  The LINQPad driver will always attempt to do a guest login, and will fail if your code disallows this.  You can work around this limitation by moving the model assembly to another folder which does not contain your custom components; or modify the driver to suit your purposes.
  • When using with DevForce 2012, make sure that all necessary assemblies are available in the folder with the model assembly, since these assemblies won't be in the GAC as they are with DevForce 2010.  There's no need to add DevForce assembly references or download a DevForce NuGet package.


What's new

  • 1.0.1 - Code First models are supported as of version 1.0.1 of the driver and DevForce 6.1.5.
  • 1.0.2 - Support for stored procedure queries, complex types, and DevForce dynamic LINQ. You can also optionally view the generated SQL for a query by setting the "Capture SQL" checkbox in the connection properties window.  Note that capturing generated SQL has some performance impact, so you may want to turn it off when query performance is important. 
  • 1.0.3 - Support for LINQPad 4.38 and later.  
    If you are using a LINQPad 4.38 Beta version prior to 4.38.05, you must also set the LINQPad option "Do not shadow assembly references" to True.  You can find this option on the Advanced Tab under Edit|Preferences.   
  • 1.0.4 - Login is no longer performed by the driver, allowing it to be used with either DevForce 2010 or DevForce 2012.

Notes and resources

  • For help on how to write queries in LINQPad, see the LINQPad documentation.
  • To get the full benefits of LINQPad, we highly recommend LINQPad Autocompletion.
  • The driver does not use static DevForce references so should work with (nearly) any version of DevForce.
  • If you get any errors or need to add either assemblies or using statements, then let us know.
  • If you want to modify the driver, the source code for the driver is available for download from the link above.  Documentation on writing a custom LINQPad driver is available here.

Created by DevForce on January 05, 2012 12:20

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade