Passing parameters to constructors using Autofac

前端 未结 4 1462
说谎
说谎 2021-01-31 02:42

I\'m very new to autofac so it\'s possible that I\'m completely misusing it.

Let\'s say I have a class that has this structure:

public class HelperClass          


        
4条回答
  •  深忆病人
    2021-01-31 02:50

    Autofac does not use non-public constructors. By default, it only finds public ones and simply doesn't see the others. Unless you use .FindConstructorsWith(BindingFlags.NonPublic), it will see only public constructors. Therefore your scenario should work as you expect it to do.

提交回复
热议问题