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?

有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top