When working with asp.net core 3 and autofac, if your controller's constructor has some additional parameters, that can not be resolved automatically, there are two (known to me) ways to properly register such controller:
- Use
WithParameter()method. - Pass a delegate (or lambda expression) that creates an instance of the controller to the
Register()method
With all controllers in .net core being registered using InstancePerLifetimeScope(), which way would be a better practice and why?