Castle Windsor won't inject Logger in a property!

前端 未结 3 559
再見小時候
再見小時候 2020-12-19 07:56

I try to inject log4net in a ILogger property of my service class but the property is always NULL!

I\'ve seen this topic but it doesn\'t help me!

How can I g

3条回答
  •  独厮守ぢ
    2020-12-19 08:28

    You could also initialize your Logger by using:

    public ILogger Logger { get; set; }
    
    public MyController()
    {
         Logger = NullLogger.Instance;
    }
    

提交回复
热议问题