Castle,AOP和登录.NET

Bri*_*Lee 7 .net logging aop castle-windsor

在使用AOP,Castle和登录.Net应用程序时,是否有任何教程或示例程序?我找到了那些东西,但我正在寻找更多的东西来帮助我形成更完整的画面.

谢谢,-Brian

jon*_*nii 8

您需要使用继承自IInterceptor的自定义Interceptor.例如:

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

希望这会有所帮助.