public static GetProfiledConnection ( ) : |
||
return |
public static DbConnection GetProfiledConnection()
{
var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BolfTracker"].ConnectionString);
// Wrap the connection with a profiling connection that tracks timings
return new StackExchange.Profiling.Data.ProfiledDbConnection(connection, StackExchange.Profiling.MiniProfiler.Current);
}
public void DeleteByMonthAndYear(int month, int year) { using (var connection = BolfTrackerDbConnection.GetProfiledConnection()) { connection.Open(); string command = "DELETE PlayerRivalryStatistics FROM PlayerRivalryStatistics prs INNER JOIN Game g ON g.Id = prs.GameId WHERE (DATEPART (month, g.[Date])) = @Month AND (DATEPART (year, g.[Date])) = @Year"; connection.Execute(command, new { Month = month, Year = year }); } }