| SharpCrafters Blog | The official blog of SharpCra |
Download demo project source code Today we're going to revisit the OnMethodBoundaryAspect class by building a profiler aspect to help us identify slow executing methods. As we saw in Day 2 OnMethodBoundaryAspect has 4 methods for us to access specific points in a methods execution OnEntry - Before the execution of the method body OnExit - Always called when a method is done executing even if there was an error OnSuccess - Called only when a method is done executing and there were no
exceptions OnException - Called only when a method has stopped executing due to an unhandled exception Each of these methods provides a MethodExecutionArgs parameter that gives us access to important data. Method Property First and most important is the Method property. This is where all of the information about the currently executing method is held. It basically provides all of the information that a System.Reflection.MethodInfo instance would hold. In fact, MethodInfo inherits from MethodBase which can be cast as MethodInfo in case more information is needed (for instance finding the return...(Read whole news on source site)




