In the project I'm working on I'm using telerik kendo ui components, more specifically the editor with image/file upload. This component makes use of a closed source standard MVC controller that allow for file listing / upload. So I can't make it a RenderMVCController nor a SurfaceController, I may only inherit from it and override some methods.
I've tried this as a way to register the custom MVC routes:
public class RegisterCustomRouteComposer : ComponentComposer<RegisterCustomRouteComponent>
{ }
public class RegisterCustomRouteComponent : IComponent
{
public void Initialize()
{
RouteTable.Routes.MapRoute(
name: "ImageBrowserController",
url: "imagebrowser/{action}/{id}",
defaults: new { controller = "ImageBrowser", id = UrlParameter.Optional });
}
}
And also:
public class RegisterHomeControllerComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.Register<ImageBrowserController>(null, Lifetime.Request);
}
}
But I'm not sure on that last snippet about the null, I had to pass it because I didn't know how to create the "factory" parameter and the example I was going by didn't even have that parameter.
Is there a simpler way? Or I just need to fix the composer? I'd appreciate some help as I've searched everything and couldn't find any propper answer to accomplish this, everyone always switches to RenderMVCController or SurfaceController and solves their problem, but that is not an option for me.
You should be able to register you MVC controller like so?
public class RegisterHomeControllerComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.Register<ImageBrowserController>(Lifetime.Request);
}
}
Need to use standard MVC controller
Hi,
In the project I'm working on I'm using telerik kendo ui components, more specifically the editor with image/file upload. This component makes use of a closed source standard MVC controller that allow for file listing / upload. So I can't make it a RenderMVCController nor a SurfaceController, I may only inherit from it and override some methods.
I've tried this as a way to register the custom MVC routes:
And also:
But I'm not sure on that last snippet about the null, I had to pass it because I didn't know how to create the "factory" parameter and the example I was going by didn't even have that parameter.
Is there a simpler way? Or I just need to fix the composer? I'd appreciate some help as I've searched everything and couldn't find any propper answer to accomplish this, everyone always switches to RenderMVCController or SurfaceController and solves their problem, but that is not an option for me.
Thanks,
João
Hi João
You should be able to register you MVC controller like so?
This extension method here: https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Core/RegisterExtensions.cs#L26
but in order to take advantage of this extensions, you will need to add
using
Umbraco.Core
to yourIUserComposer
implementation....regards
Marc
Hi Marc.
That's exactly it! I had missed the extension method. Thank you very much for you help, it is working now.
is working on a reply...