Hi, I have a BaseController that I'm using to house my cross cutting concerns for an MVC project.
However, this means that my Controller has 3 dependencies:
public BaseController (IUserService u, ITenantDetailsService t, ISiteConfiguration c)
The side effect of this is that my constructors for each derived controller are awash with parameters:
public AccountController(ILocationService locationService, IAccountService accountService, IFormsAuthentication formsAuth, IMembershipService service, IUserService userService, ISiteConfiguration configuration)
: base(locationService,userService, configuration )
I'm using IoC (Windsor) to resolve my controllers, so know that I could remove the constructor dependencies and let it auto-wire the public properties up.
Is there a reason for not doing this other than masking some of the dependencies?
public AccountController (IAccountService, IFormsAuthentication, IMembershipService)
This approach seems more readable and gives a clear overview of the dependencies relevant to that specific controller.
Or have I got it all wrong and a BaseController isn't the correct place to store the cross cutting services.
Thoughts appreciated.
Thanks, Chris