/// <summary> /// Returns an open connection that will have its queries profiled. /// </summary> public static DbConnection GetConnection(MiniProfiler profiler = null) { using (profiler.Step("GetOpenConnection")) { DbConnection cnn = new System.Data.SQLite.SQLiteConnection(MvcApplication.ConnectionString); // to get profiling times, we have to wrap whatever connection we're using in a ProfiledDbConnection // when MiniProfiler.Current is null, this connection will not record any database timings if (MiniProfiler.Current != null) { cnn = new MvcMiniProfiler.Data.ProfiledDbConnection(cnn, MiniProfiler.Current); } cnn.Open(); return(cnn); } }
/// <summary> /// Returns an open connection that will have its queries profiled. /// </summary> public static DbConnection GetConnection(MiniProfiler profiler = null) { using (profiler.Step("GetOpenConnection")) { DbConnection cnn = new System.Data.SQLite.SQLiteConnection(WcfCommon.ConnectionString); // to get profiling times, we have to wrap whatever connection we're using in a ProfiledDbConnection // when MiniProfiler.Current is null, this connection will not record any database timings if (MiniProfiler.Current != null) { cnn = new MvcMiniProfiler.Data.ProfiledDbConnection(cnn, MiniProfiler.Current); } cnn.Open(); return cnn; } }