小编use*_*244的帖子

C#ExceptionFilterAttribute中的依赖注入

我在应用程序中使用Castle Windsor,我想在ExceptionFilterAttribute中使用注入一些服务示例ILog:

public class GenericExceptionFilterAttribute : ExceptionFilterAttribute
{
    private readonly ILog _logger;

    public GenericExceptionFilterAttribute()            
    {

    }

    public GenericExceptionFilterAttribute(ILogManager logManager)
    {
        _logger = logManager.GetLogger(typeof(GenericExceptionFilterAttribute));
    }
}
Run Code Online (Sandbox Code Playgroud)

我如何在该课程中注入服务?

问候

卡洛斯

c# dependency-injection castle-windsor inversion-of-control asp.net-web-api

3
推荐指数
1
解决办法
1746
查看次数