1

I am trying to implement AOP using StructureMap and Castle.Core. I am using the latest versions.

I am able to make it with the default constructor, but what I need to inject the logger into the constructor of the IInterceptor. How can I do this.

public class IwInterceptor : IInterceptor
{
    private readonly IwLogger logger;


    public IwInterceptor(IwLogger logger)
    {
        this.logger = logger;
    }

    public void Intercept(IInvocation invocation)
    {
        logger.Debug("Entered " + invocation.Method.Name);
        invocation.Proceed();
        logger.Debug("Left");
    }
}
user1124707
  • 135
  • 1
  • 11
  • https://gist.github.com/tolemac/3e31b44b7fc7d0b49c6547018f332d68 it was really a great effort, but eventually I found this gist and solved my case, all the best – ale Mar 01 '17 at 14:02

0 Answers0