Skip to content

Instantly share code, notes, and snippets.

@leethomascook
Last active August 29, 2015 14:18
Show Gist options
  • Save leethomascook/140b16bb690ebfdcee65 to your computer and use it in GitHub Desktop.
Save leethomascook/140b16bb690ebfdcee65 to your computer and use it in GitHub Desktop.
Mini Profiler Aspect with Postsharp
using System;
using PostSharp.Aspects;
using StackExchange.Profiling;
namespace xxx.Core.Logging
{
[Serializable]
public sealed class MiniProfilerAttribute : MethodInterceptionAspect
{
public override void OnInvoke(MethodInterceptionArgs context)
{
using (MiniProfiler.Current.Step(context.Method.DeclaringType.FullName))
{
context.Proceed();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment