I'm using the Unity container for dependency injection in an ASP.NET MVC 4 application.
For a particular controller (say ProductController), I have an dependency injection scenario as follows:
What's the correct way to do automatic dependency injection in this scenario, considering that the authentication token cookie can only be retrieved after the controller instance has been created?
If you need to delay the creation of the ProductService
you can
Func<IProductService>
and inject that delegate into your controllerI prefer the third alternative as it is completely transparent for the consumers of IProductService