Added container accessor to Castle.Core
[castle.git] / AspectSharp / AopAlliance / Intercept / IMethodInterceptor.cs
blobabd5bedb592f9d8e6fa539a3d4f301bb68adfada
1 using System;
3 namespace AopAlliance.Intercept
5 /// <summary>
6 /// <p>Intercepts calls on an interface on its way to the target. These are nested "on top" of the target.</p>
7 /// </summary>
8 /// <example>
9 /// <p>The user should implement the <c>Invoke(IMethodInvocation)</c> method to modify the original behavior.</p>
10 /// <code>
11 /// class TracingInterceptor : IMethodInterceptor
12 /// {
13 /// Object Invoke(IMethodInvocation i)
14 /// {
15 /// Console.WriteLine("Method {0} is called on {1} with args {2}", i.GetMethod(), i.GetThis(), i.GetArguments());
16 /// object ret = i.Proceed();
17 /// Console.WriteLine("Method {0} returned {1}", i.GetMethod(), ret);
18 ///
19 /// return ret;
20 /// }
21 /// }
22 /// </code>
23 /// </example>
25 public interface IMethodInterceptor : IInterceptor
27 /// <summary>
28 /// Implement this method to perform extra treatments before and after the invocation.
29 /// Polite implementations would certainly like to invoke IJoinpoint.Proceed().
30 /// </summary>
31 /// <param name="invocation">The method invocation joinpoint</param>
32 /// <returns>The result of the call to IJoinpoint.Proceed(), might be intercepted by the interceptor.</returns>
33 /// <exception cref="System.Exception">if the interceptors or the target-object throws an exception.</exception>
34 object Invoke(IMethodInvocation invocation);