Reputation: 35213
I would like to know if there is a way to implement a similar solution to Register subset of Web API controllers with simple injector, but for MVC controllers rather than web api controllers?
More specifically, it's Umbraco's RenderMvcController
that I want to register. If I simply use the MVC integration package I get the error described here: Using Simple Injector with Umbraco Controller. The proposed solution will hook in to the controllers used by Umbraco's "backoffice" as well. Is there an easy way to leave them intact?
I have tried registering my controllers explicitly, but still get the error mentioned in the thread above.
Upvotes: 0
Views: 243
Reputation: 35213
I noticed that some views were missing a default controller, which made Umbraco serve a RenderMvcController under the hood. Solved by adding a default controller, which I registered along with my explicit ones:
protected override void ApplicationStarting(
UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(
typeof(DefaultController));
}
Upvotes: 2