I'm receiving the error "Connection property has not been initialized" with the following code:
DbConnection connection = new SqlConnection(connStr);
connection.Open();
connection = new StackExchange.Profiling.Data.ProfiledDbConnection(connection, MiniProfiler.Current);
SqlCommand command = new SqlCommand("GetLanguages", connection as SqlConnection);
command.CommandType = CommandType.StoredProcedure;
command.CommandTimeout = 240;
command.ExecuteReader();
when it gets to the command.ExecuteReader(); line.
If remove the line
connection = new StackExchange.Profiling.Data.ProfiledDbConnection(connection, MiniProfiler.Current);
then the code works fine. What is it about the profiled db connection that is causing my execute reader to throw the error?