城堡,AOP和登录.NET城堡、AOP、NET

2023-09-03 00:31:55 作者:劫°

是否有任何教程或示例程序在那里使用AOP,城堡,和记录在.Net应用程序?我发现片在那里,但我期待更多的东西来帮助我形成了较为完整的画面。

Are there any tutorials or sample programs out there on using AOP, Castle, and logging in a .Net application? I have found pieces out there but I am looking for something more to help me form a more complete picture.

谢谢, -Brian

Thanks, -Brian

推荐答案

您需要使用自定义拦截器,它继承自IInterceptor。例如:

You need to be using a custom Interceptor, which inherits from IInterceptor. For example:

public class LogInterceptor : IInterceptor
{    
    public void Intercept(IInvocation invocation)
    {
        Logger.Write("I'm in your method logging your access");
        invocation.Proceed();
    }
}

希望这有助于。

Hopefully this helps.