Getting Started
Using the Linq to Sql Profiler is easy. First, we need to make the application that we profile aware of the profiler. Then, just start the profiler.
Preparing an application to be profiled
Add a reference to the HibernatingRhinos.Profiler.Appender.dll assembly, located in the downloadable zip. In the application startup (Application_Start in web applications, Program.Main in Windows / console applications, or the App constructor for WPF applications), make the following call:
HibernatingRhinos.Profiler.Appender.LinqToSql.LinqToSqlProfiler.Initialize();
Profiling a Linq to Sql application using POCO model
If you are not using the designer to generate your data context, you need to register the mapping source with the profiler in order to be able to profile it. This is done using:
HibernatingRhinos.Profiler.Appender.LinqToSql.LinqToSqlProfiler
.SetupProfilingFor<NorthwindDataContext>(NorthwindDataContext.MappingSource); HibernatingRhinos.Profiler.Appender.LinqToSql.LinqToSqlProfiler.Initialize();
Where the NorthwindDataContext is your implementation of the data context and the mapping source passed to the SetupProfilingFor() method is the singleton instance used by the application.