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
- 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.
- For Internet Explorer: Extract the .lpx file from the zip download. For other browsers, download the .lpx file directly.
- Copy the .lpx to a folder on your hard drive.
- Open LINQPad
- Click Add connection.
The following dialog is displayed:
- Click View more drivers….
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.
- Once installed, the driver is available in the LINQPad Choose Data Context dialog:
Use the DevForce LINQPad driver
- 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:
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.
Once selected, you will see your EntityQuery properties in the left pane. You can drill in to see the properties for the entity.
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:
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.
- Pick Language: C# expression if you’re only trying a single query (don’t terminate with ; and don’t assign to variables).
- 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.