If you need an aggregation service (as the Autofac documentation calls it), this may be a sign of a violation of the Single Responsibility Principle , which means that a class must do one thing and only one.
In other words, the aggregate service pattern is the smell of code *.
Having large base classes is the smell of code , because base classes tend to grow and evolve into large and complex classes that contain a lot of code that not all subtypes use. Instead, the general advice is to composition over inheritance .
However, with user interface interfaces such as ASP.NET MVC, this is not always easy, since most frameworks themselves contribute to inheritance.
Try to extract the logic of the base class to separate the dependencies, especially if this code in the base class is not used by all subtypes. For example, you can reorganize the RedirectToDefaultPage method to the following:
public class DefaultPageRedirector { private readonly ICookieService cookieService; public DefaultPageRedirector(ICookieService cookieService) { this.cookieService = cookieService; } public ActionResult RedirectToDefaultPage( Controller controller) { var page = this.cookieService.GetDefaultPageCookie( controller.Request, controller.RouteData);
This way you can only enter DefaultPageRedirector into the types of Controller that really need it.
For OnActionExecuting it is different, as it is called for each subtype. However, the ViewData["UserName"] property will probably not be used by every View on the system, in which case you should consider returning the UserName as part of the (statically typed) ViewModel object. If it is used by most views, you might consider using a partial view because you might have some repeating code in your views (the DRY principle holds not only for code, but for every part of the system).
This will probably save most of the code from the base class, which will probably also remove most of the dependencies in the database (if not all).
* Please note that the smell of code does not mean that there is always a problem. To quote Wikipedia: "The smell of code is any symptom in the source code of a program that may indicate a deeper problem."