Autofac difference between Register and RegisterType

前端 未结 3 1178
野的像风
野的像风 2021-02-20 14:01

I have started to use Autofac following this tutorials: http://flexamusements.blogspot.com/2010/09/dependency-injection-part-3-making-our.html

Simple class with no pa

3条回答
  •  清歌不尽
    2021-02-20 14:16

    Btw there is a better solution to this Autofac introduced the .WithParameter() extension to their registration builder.

    .RegisterType().As().WithParameter("parameterName", "parameterValue");
    

    This should cater for the event that you need to pass something other than an interface type to one of your constructors

提交回复
热议问题