Pregunta

I am using LINQ to SQL for much of the data access layer and am trying to view and tune the underlying SQL used. Does anyone know a good mechanism to intercept the SQL used by C# LINQ and/or replace it with a more tuned query?

¿Fue útil?

Solución

I highly recommend using LINQPad to analyze and optimize your LINQ. You can display generated SQL and check also how long certain query took.

You can also use it with existing project that uses Entity Framework. See more details here.

Otros consejos

The DataContext itself has a Log property which is a TextWriter, using this you can write out to whatever you want be it the framework TraceClasses or something Like Log4Net or NLog

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top