Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carl Sjöholm 44 posts 327 karma points
    Mar 09, 2019 @ 11:00
    Carl Sjöholm
    1

    DefaultRenderMvcControllerResolver

    How do you implement a similar feature like DefaultRenderMvcControllerResolver in Umbraco8?

    https://our.umbraco.com/documentation/Reference/Routing/custom-controllers

    I was looking into UmbracoControllerFactory and RenderControllerFactory.

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    Mar 09, 2019 @ 12:12
    Kevin Jump
    101

    Hi Carl,

    you can set the default render item, in a Composer . (which is part of the new startup routines) - your RenderController needs to implement IRenderMvcController (which is auto-discovered so you don't need to add that explicity to a composition)

    public class MyComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.SetDefaultRenderMvcController(typeof(MyMvcController));
        }
    }
    
    public class MyMvcController : IRenderMvcController
    {
        public void Execute(RequestContext requestContext)
        {
            throw new NotImplementedException();
        }
    
        public ActionResult Index(ContentModel model)
        {
            throw new NotImplementedException();
        }
    }
    
  • Carl Sjöholm 44 posts 327 karma points
    Mar 09, 2019 @ 13:41
    Carl Sjöholm
    0

    Nice! Thanks.

    Can't wait for more documentaion on version 8.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies