Run ad-hoc LINQ queries against LightSpeed from LINQPad
LINQPad is a fantastic tool that allows developers to quickly and easily execute LINQ queries against their database. Now with LINQPad 2.0+, LINQPad supports a plug-in model which means developers can couple the convenience of LINQPad with the power of LightSpeed!
Because the driver uses LightSpeed, you’ll be able to use all the facilities of LightSpeed — for example, to perform Lucene-based full-text search from within LINQPad, or to include or exclude soft-deleted entities from the query.
Where to get LINQPad
If you have not used LINQPad before, you can download it for free at the official LINQPad website here.
Using the LightSpeed driver with LINQPad
To get the LightSpeed driver, just go into LINQPad, click Add Connection in the data sources list, choose View more drivers..., and choose the LightSpeed driver from the list. LINQPad will automatically download and install it. Once this is done, you'll see LightSpeed in the Add Connection dialog. Select LightSpeed and click Next.
Now all you need to do is configure the connection with details of your database and the assembly containing your LightSpeed model. You’ll need to tell LINQPad the following details:
- What kind of database you’re talking to (SQLite, MySQL, SQL Server, etc.)
- The connection string for the database
- The assembly containing the LightSpeed model (your compiled EXE or DLL)
- The strong-typed unit of work class in that assembly (don’t forget the namespace!)
To save time, you can also use the Infer from Model button to extract this configuration information from your .lsmodel file. (You’ll still need to have built the DLL or EXE though.)
You can also set up LightSpeed context properties such as whether table names in the database are pluralised and whether to quote identifiers in queries. If you’re planning to use LINQPad to do ad hoc inserts and updates, you can also specify the identity method and timestamp strategy.
That’s it! You’re ready to get querying!
What do you think?
We appreciate any feedback - new features are added based on the feedback of our users, please let us know what you think!