I have a situation where the fact that the user is not logged in does not allow me to create my dependencies between controllers.
[Authorize]
class MyController : Controller
{
public MyController(MyService service)
{
}
}
class MyService
{
public MyService()
{
}
}
My question is: can I do something so that the MVC environment first looks at the Authorize attribute and then resolves the controller instance?
The above would be much more preferable for me than one of the following:
- Modifying the MyService service to work with creation before the user logs in
- Func Injection
- Go to service location
MVC, : " , , - ..."