.NET 中的 Castle、AOP 和日志记录 [英] Castle, AOP and Logging in .NET
本文介绍了.NET 中的 Castle、AOP 和日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有关于使用 AOP、Castle 和登录 .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.
谢谢,-布莱恩
推荐答案
您需要使用从 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();
}
}
希望这会有所帮助.
这篇关于.NET 中的 Castle、AOP 和日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文