I have an existing db connection function in a web form application that I would like to integrate with the mini profiler . I have a mini profiler installed and running in the application, but it seems I canβt connect part of the database correctly. The following is part of the code that we associate with db c.
public override IEnumerable<IDataRecord> Execute() { using( SqlConnection conn = new SqlConnection( ConnectionString ) ) { using( SqlCommand command = new SqlCommand( CommandText, conn ) ) { command.CommandType = SQLCommandType; foreach( SqlParameter p in ParamsToAdd ) { command.Parameters.Add( p ); } conn.Open(); SqlDataReader rdr; try { rdr = command.ExecuteReader(); } catch( Exception ex ) {
I can easily take a step around ExecuteReader () as follows:
using( MiniProfiler.Current.Step( command.CommandText ) ) { rdr = command.ExecuteReader(); }
but this makes the mini profiler as useful as tracing, and I want to get the query functions shown on the site. Any help?
source share