/src/LinFu.AOP.Interfaces/CountingInterceptor.cs
http://github.com/philiplaureano/LinFu · C# · 25 lines · 20 code · 5 blank · 0 comment · 0 complexity · 260c97ea383b72f85cd6f0f668bc375d MD5 · raw file
- namespace LinFu.AOP.Interfaces
- {
- internal class CountingInterceptor : IInterceptor
- {
- private readonly ICallCounter _callCounter;
- private readonly IInterceptor _methodReplacement;
- internal CountingInterceptor(ICallCounter callCounter, IInterceptor methodReplacement)
- {
- _callCounter = callCounter;
- _methodReplacement = methodReplacement;
- }
- public object Intercept(IInvocationInfo info)
- {
- _callCounter.Increment(info);
- var returnValue = _methodReplacement.Intercept(info);
- _callCounter.Decrement(info);
- return returnValue;
- }
- }
- }