Skip to content

Instantly share code, notes, and snippets.

@WilliamBerryiii
Created September 26, 2015 22:25
Show Gist options
  • Save WilliamBerryiii/b99e6aceb25f31a380f8 to your computer and use it in GitHub Desktop.
Save WilliamBerryiii/b99e6aceb25f31a380f8 to your computer and use it in GitHub Desktop.
Example of timing a repository method
public static DataSet GetSomeStuffFromTheDatabase(int thingId)
{
const string PROCEDURE_NAME = "GetMeSomeData";
var parameterLisst = new SqlParameterList();
parameterList.Add("@thing_id", SqlDbType.Int, thingId);
var sw = Stopwatch.StartNew();
var results = _sqlExecutioner.ExecuteQuery(_connectionString, PROCEDURE_NAME, parameterList);
sw.Stop();
_timeToExecuteGetSomeStuffFromTheDatabase = sw.Elapsed;
return results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment