/src/SampleLibrary/IOC/SampleAroundInvokeInterceptorClass.cs

http://github.com/philiplaureano/LinFu · C# · 31 lines · 25 code · 6 blank · 0 comment · 0 complexity · f4b8afd96ed340cf45b262fefe29a01b MD5 · raw file

  1. using LinFu.AOP.Interfaces;
  2. using LinFu.IoC;
  3. using LinFu.IoC.Configuration;
  4. using LinFu.IoC.Interceptors;
  5. using LinFu.IoC.Interfaces;
  6. namespace SampleLibrary.IOC
  7. {
  8. [Intercepts(typeof(ISampleWrappedInterface))]
  9. public class SampleAroundInvokeInterceptorClass : IAroundInvoke, IInitialize, ITargetHolder
  10. {
  11. public void BeforeInvoke(IInvocationInfo info)
  12. {
  13. Target = info.Target;
  14. }
  15. public void AfterInvoke(IInvocationInfo info, object returnValue)
  16. {
  17. }
  18. public void Initialize(IServiceContainer source)
  19. {
  20. var typeName = GetType().Name;
  21. source.AddService<ITargetHolder>(typeName, this);
  22. }
  23. public object Target { get; set; }
  24. }
  25. }