Constructor injection into a base class using autofac

前端 未结 3 872
死守一世寂寞
死守一世寂寞 2021-01-31 09:15

I have an abstract base controller which has a constructor I hoped would be populated by autofac when the controllers were built.

public abstract class BaseContr         


        
3条回答
  •  鱼传尺愫
    2021-01-31 09:59

    Autofac for .NET Core

    Install

    PM> Install-Package Autofac.Core.NonPublicProperty
    

    Use

    builder.RegisterType()
      .AsImplementedInterfaces()
      .AutoWireNonPublicProperties();
    

提交回复
热议问题