Skip to content

Instantly share code, notes, and snippets.

@nootn
Created February 5, 2013 11:59
Show Gist options
  • Save nootn/4714037 to your computer and use it in GitHub Desktop.
Save nootn/4714037 to your computer and use it in GitHub Desktop.
MiniProfiler.Windows IOC and AOP #3
using System;
using System.Reflection;
using Castle.DynamicProxy;
using Snap;
using StackExchange.Profiling;
namespace ConsoleApplicationWithIocAndAop.AOP
{
public class ProfileMethodInterceptor : MethodInterceptor
{
public override void InterceptMethod(IInvocation invocation, MethodBase method, Attribute attribute)
{
//Wrap each method call with a profiler step, using the method name as the step name
using (StackExchange.Profiling.MiniProfiler.Current.Step(method.Name))
{
invocation.Proceed();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment