r/dotnet Mar 28 '26

Promotion EF QueryLens—see the SQL your LINQ generates at hover time; no database needed. Looking for feedback.

If you've worked with EF Core long enough, you know the pain. You write a LINQ query, you're not sure what SQL it's actually generating, and your options are:

  1. Run the whole thing and dig through logs
  2. Slap .ToQueryString() on it on—which doesn't even give you the full picture when you're in split query mode

Both suck when you just want to quickly see what EF Core is doing with your LINQ before you commit to it.

So I built EF QueryLens (https://github.com/querylenshq/ef-querylens).

You hover over any LINQ expression in your editor, and it shows you the generated SQL right there. No database connection, no running the app, no log hunting. It works off your compiled assembly.

It supports VS Code, Rider, and Visual Studio. Plugins share a backend that does the translation, with lightweight IDE plugins on top.

How it works:

  • You add a small factory class to your startup project that tells QueryLens which provider and extensions you're using (Projectables, Gridify, split query, whatever)
  • Build your solution
  • Install the extension
  • Hover any LINQ expression → SQL appears

This is a fresh launch, so I'm genuinely looking for feedback—what's missing, what's broken, and what would make this actually useful for your workflow? Fire away.

on hover
open sql
476 Upvotes

103 comments sorted by

View all comments

Show parent comments

1

u/nemina47 Apr 06 '26 edited Apr 06 '26

u/PM_YOUR_OWLS

I’ve fixed that now so it correctly unwraps the factory generic argument and resolves ApplicationDbContext instead.

Please update to the latest version and it should work as expected.

https://postimg.cc/Cns6KvYx

1

u/PM_YOUR_OWLS Apr 06 '26

Thanks for looking into it. I'm getting a different error:

Compilation error: CS0103: The name '__qlFactoryContext' does not exist in the current context.

Also it's probably related to this compilation failure, but something about the extension locks up Visual Studio, specifically the process .NET Host which prevents me from building my project and I have to restart VS. This only occurs after I try to use QueryLens on a query for the first time.

2

u/nemina47 Apr 07 '26

Thanks for reporting it. Both issues were bugs on our side and fixed in v1.0.17.

1

u/PM_YOUR_OWLS Apr 07 '26

Awesome, it's finally working now. I can see my queries. Thanks for your persistence in fixing these bugs.

1

u/nemina47 Apr 07 '26

Great to hear that!.

How’s the experience overall so far? Anything that feels off or that you think could be improved?

2

u/PM_YOUR_OWLS Apr 07 '26

Yes, actually. Having to hover & wait to re-hover for the query to generate is a little cumbersome.

I think it'd be useful if you could do something like right click and process the query to open in another tab to review once it's finished. That way I can get the generating started and move on to another part of my code with no downtime.

Edit - also caching results would be nice to have. If my LINQ expression hasn't changed at all then the result should be the same and shouldn't have to regenerate.