PageRenderTime 38ms CodeModel.GetById 34ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/SampleLibrary/IOC/SampleInterceptorClass.cs

http://github.com/philiplaureano/LinFu
C# | 29 lines | 23 code | 5 blank | 1 comment | 0 complexity | 7ccf0c6748232183216d0a7aaf916b32 MD5 | raw file
 1using LinFu.AOP.Interfaces;
 2using LinFu.IoC;
 3using LinFu.IoC.Configuration;
 4using LinFu.IoC.Interceptors;
 5using LinFu.IoC.Interfaces;
 6
 7namespace SampleLibrary.IOC
 8{
 9    [Intercepts(typeof(ISampleInterceptedInterface))]
10    public class SampleInterceptorClass : IInterceptor, IInitialize, ITargetHolder
11    {
12        public void Initialize(IServiceContainer source)
13        {
14            var typeName = GetType().Name;
15            source.AddService<ITargetHolder>(typeName, this);
16        }
17
18
19        public object Intercept(IInvocationInfo info)
20        {
21            // Set the target on every method call
22            Target = info.Target;
23            return null;
24        }
25
26
27        public object Target { get; set; }
28    }
29}