public static IDisposable StartContext(string key, params object[] stringFormatParameters)
{
if (!Enabled)
return new DummyProfiler();
Enabled = false;//don't profile the profiler
try
{
var profiler = IoC.Resolver.Resolve<Profiler>();
if (stringFormatParameters != null && stringFormatParameters.Length > 0)
{
key = string.Format(key, stringFormatParameters);
}
return new ProfilingContext(key, profiler._performanceProfilers);
}
finally
{
Enabled = true;
}
}