Referenced Library Not Having LINQ-to-SQL Queries Display in Resulting SQL Tab

I have two assemblies (plugins) for LINQPad. One contains the database entities (EntityFrameworkCore) and the other is a very large library of various things in which some query the database view the entities in the other assembly. The data context used by the 2nd library uses LINQPad's Util.CurrentDataContext to get the instance of the data context (which is a connection in LINQPad I created via the "Use a typed data context from your own assembly" and the driver "Entity Framework Core (3.x -> 7.x)".

When I run a LINQPad script that calls a method in the 2nd assembly and that method queries the data from Util.CurrentDataContext (cast to my custom context in the 1st assembly) all is well and it works like a charm!

However, one thing it's lacking is the generated SQL does not get displayed in the result window's SQL output panel. I know I can manually write to that panel from the 2nd assembly, but I'm wondering (i.e., hoping) that there is some setting or some other way to have all SQL generated by the 2nd assembly automatically display in that panel?

Yes, the above is clear as mud. Sorry! :(


  • Does it help if you call EnableLINQPadLogging on your DbContext:


  • I can't seem to find where EnableLINQPadLogging is defined (which assembly & namespace) in order for it to be available to call :( Note that I'm using Microsoft Visual Studio 2019 (to write/build the EntityFrameworkCore and other utility library) and LINQPad7 which is used to call into the utility library which performs the data fetches and updates through the EntityFrameworkCore library.

  • This is an extension method in the LINQPad namespace. If you want to do this within Visual Studio, you'd need to reference the LINQPad.Runtime package and wrap the code in a #if LINQPAD directive.

  • I wonder what I'm missing. Been a long week or two :(

    Using ILSpy to decompile and search LINQPad.Runtime came up with 0 hits for any member named EnableLINQPadLogging. Not sure if it's a version issue or it's just not present? I tried it via opening the DLL from the Nuget package LINQPad.Runtime as well as opened the LINQPad.Runtime in the LINQPad7 install folder (just in case they were different assemblies for some reason).

  • It is in LINQPad.Drivers.EFCore.dll which on my machine is located in (or extracted to) %LocalAppData%\LINQPad\7.8.4\EF (where 7.8.4 is the LinqPad version number). The name space is LINQPad.EFCoreExtensions,

    But if your script uses an EF connection, then it seems the dll and namespace are automatically available, so don't need to be hardcoded.

    (I have a script that uses a dummy EF connection, just to get access to this method without having to hardcode a dll from a specific LinqPad version)

Sign In or Register to comment.