Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In Umbraco v9 beta versions there was a way to override the default controller type by issuing:
typeof(IUmbracoRenderingDefaults), typeof( MyUmbracoRenderingDefaults ), ServiceLifetime.Singleton));
But the IUmbracoRenderingDefaults interface is gone in rc-001 and I can't find the correct way to override the default controller type.
Thanks in advance.
Think this has been updated for RC001 to use IOptions pattern...
You can assign a default RenderController to be a custom implementation by updating the options for UmbracoRenderingDefaultsOptions in the ConfigureServices method in the Startup.cs class.
First of all you have to create your own controller. Your custom implementation of RenderController should either inherit from the core RenderController as in the examples above or implement the IRenderController interface.
Once you've created your controller then you now use
the DefaultRenderController extension method in the ConfigureServices method in the Startup.cs class. (call SetDefaultRenderController method after the AddWebsite method)
public void ConfigureServices(IServiceCollection services)
// Configure Umbraco Render Controller Type
c.DefaultControllerType = typeof(MyRenderController);
Thanks for taking the time to explaining this IOptions pattern.
Using services.Configure<>() as you describe solves my problem.
I found one difference, though: it looks like the .SetDefaultRenderController() extension you mention does not exist in v9.0.0-rc001 ...nor it is required, because the solution works without that line - just using services.Configure<>() does the trick and sets the default render controller.
A google search for the missing method got me to this discussion which seems to confirm the fact that the method is not required.
Can you please clarify that point before I mark your response as the solution?
Thanks for trying it out and reporting back!
Yes you are correct SetDefaultRenderController() is no longer required...
In the eagerness to document things! the SetDefaultRenderController() extension method got added to some draft documentation, but then got switched to IOptions approach - which we then updated, but didn't take out the extension method!!!
I'll update the docs page accordingly.
But hopefully that aleviates your immediate concerns!
Ok updated docs here:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted