Finsished restful support and added tess to demonstrate restful services hosted in...
[castle.git] / AspectSharp / AopAlliance / Intercept / IConstructorInterceptor.cs
blob859982649ca890f6088cef0602c9796d55be6405
1 using System;
3 namespace AopAlliance.Intercept
5 /// <summary>
6 /// <p>Intercepts the construction of a new object.</p>
7 /// </summary>
8 /// <example>
9 /// <p>The user should implement the <c>Construct(IConstructorInvocation)</c> method to modify the original behavior.
10 /// E.g. the following class implements a singleton interceptor (allows only one unique instance for the intercepted class): </p>
11 /// <code>
12 /// class DebuggingInterceptor : IConstructorInterceptor
13 /// {
14 /// object instance = null;
15 ///
16 /// object Construct(IConstructorInvocation i)
17 /// {
18 /// if (instance == null)
19 /// {
20 /// return instance = i.Proceed();
21 /// }
22 /// else
23 /// {
24 /// throw new Exception("singleton does not allow multiple instance");
25 /// }
26 /// }
27 /// }
28 /// </code>
29 /// </example>
30 public interface IConstructorInterceptor : IInterceptor
32 /// <summary>
33 /// <p>Implement this method to perform extra treatments before and after the consrution of a new object.
34 /// Polite implementations would certainly like to invoke IJoinpoint.Proceed(). </p>
35 /// </summary>
36 /// <param name="invocation">The construction joinpoint </param>
37 /// <returns>The newly created object, which is also the result of the call to IJoinpoint.Proceed(), might be replaced by the interceptor.</returns>
38 /// <exception cref="System.Exception">if the interceptors or the target-object throws an exception.</exception>
39 object Construct(IConstructorInvocation invocation);