We heavily use ORMs in our web application (EF and LLBlGen) and we have a DBA helping us improve the performance of the application by finding queries that are causing the most problems. We have a lot of linq queries accessing the database and some are quite complex.
Is there a way to tag the generated SQL with some identifier from Linq queries so that if the DBA finds some bad sql we can then easily go find the linq statements that generated it.
Thanks to @ErikEj for pointing me in the write direction. For EF Core I can use Query Tags https://learn.microsoft.com/en-us/ef/core/querying/tags
For LLBLGen I can use the MarkWithTag() extension method they provide for IQueryable. https://www.llblgen.com/Documentation/5.5/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Linq/gencode_linq_generalusage.htm#query-tagging
Entity Framework appears more difficult and doesn't have a specific method to achieve the desired outcome and required adding a redundant select or where clause. How to "tag" Entity Framework Queries