Show all linq sql queries for query

I want to show in my application a list of all executed linq to sql queries (with completed time it would be nice) on each page for the current query (as debugging information).

Does anyone know how to do this, or maybe someone already created a class for this?

Thank!

+3
source share
1 answer

DataContext supports logging through the log property . Just attach an instance of TextWriter and you can see all the generated instructions. Like this:

var dc = new DataContext();
dc.Log = Console.Out;

This will register all operators in the console window.

LINQ to SQL log to debug window, file, memory Damien Guard. , ..

Linq 2 Sql profiler Ayende. , NHProf, .

+4

All Articles