Black Friday is here! Get up to 30% off on Devart products!
ends in   {{days}}
Days
{{timeFormat.hours}}
:
{{timeFormat.minutes}}
:
{{timeFormat.seconds}}

LINQPad Support in LinqConnect

LinqConnect aims to simplify data access layer development. In order to provide better query analysis capabilities, LinqConnect supports LINQPad - a well-known tool for executing LINQ queries to various relational databases and other data sources.

Our ORM allows both connecting to a database via a dynamic driver, using an automatically built context and entities, and via a static driver, using existing DataContext classes directly from an already built assembly with LinqConnect model classes.

Installation

Installing LinqConnect driver for LINQPad is easy, just perform the following steps:

  1. Click Add connection.
  2. In the Choose Data Context dialog box click the View More Drivers button.
  3. In the Choose a Driver dialog box click Browse.
  4. Navigate to the LinqConnect installation directory (by default %Program Files%\Devart\dotConnect\Linq\, select the LinqConnectDriver.lpx file, and click Open. Then click OK in the displayed message.

The driver is installed and you may choose whether to connect using automatically built context or to use a DataContext from an already built assembly.

Creating Connection via Dynamic Driver

When you create such a connection, a LinqConnect model is automatically generated for all tables (and optionally views and stored routines) in the specified connection. Then you may query this model with LINQ statements from LINQPad.

To create a connection via automatically built context and model, click Add connection, select the Devart LinqConnect driver under Build data context automatically, and click Next. After that the Devart LinqConnect Configuration dialog box opens.

Devart LinqConnect Configuration dialog box in LINQPad - Connection tab
Devart LinqConnect Configuration dialog box in LINQPad - Naming Rules tab

On the Connection tab of this dialog box you need to choose the provider for connecting to database and specify the connection settings. Here you can also select whether to use tables from all schemas or from only the specified one, whether to include views and stored rotines to the model.

On the Naming Rules tab you can set the of name generaton rules for entities and their members.

After you click OK, the connection is created and you may run queries against the specified database.

Connection via LinqConnect in LINQPad

Creating Connection via Static driver

To create a connection via the static driver, using an existing data context from an assembly, click Add connection, select the Devart LinqConnect driver under Use a typed data context from your own assembly, and click Next. After that the Devart LinqConnect Configuration dialog box opens.

On the Configuration tab of this dialog box you need to select an assembly, containing the data context class. In most cases, other fields will be filled automatically. However in some cases (for example, when the selected assembly contains more than one LinqConnect data context class), you may need to specify the data context class name. If it loads the connection string from the project config file, you may need to specify this file if it was not found automatically.

Devart LinqConnect Configuration dialog box in LINQPad - Configuration tab

If you need, you may override the automatically selected connection string with your own one. Switch to the Connection tab, select the Use Custom connection check box and specify the connection settings on this tab. In such case, specifying the config file is not necessary.

After you click OK, the connection is created and you may run queries against the specified data context. Note that the connection is populated by entities from the specified context. If there no corresponding database objects in the specified connection database, error will occur when executing a query.