我创建了一个自定义LogFilterAttribute,我想将ILog对象注入Logger属性。当我调试项目时,ActionFilterAttribute的属性Logger为null。
public class LogFilterAttribute : ActionFilterAttribute
{
/// <summary>
/// Get or sets the value of the logger object
/// </summary>
public ILog Logger { get; internal set; }
//some loggging with the Logger Property in the overriden methods
}
我在RegisterServices方法的NinjectWeCommon.cs中注册了注入。
kernel.Bind<LogFilterAttribute>().ToSelf().WithPropertyValue("Logger", LogManager.GetLogger(typeof(Global)));
当我在LogFilterAttribute中附加到调试器时,属性Logger为null。我该如何解决这个问题?
(配置在web.config中设置)
问候