Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

[Enhancement]: MVC pipeline - Module Pipeline / Module rendering

Open sachatrauwaen opened this issue 4 months ago • 4 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description of problem

We'll need a way to determine if a module can work on the MVC pipeline and how it will be rendered.

Description of solution

  • mvc control class in the module control settings (and module manifest)
Image

The control class needs to implement IMvcModuleControl and can also implement optional interfaces like IActionable

Image

The Control method responsible for generating the html of the control has a HtmlHelper parameter witch give information of the httpcontext, controller, page model. It give also the possibility to the module to use an html helper to render the html (razor partial, child action controller or other helpers).

Here how this can work for the different kind of modules

Module pipeline Webforms support MVC module support SPA module support
Create a custom Control
+
Custom MVC Child Controller or partial
Use generic Control
+
Custom MVC Controller as child controller
(shared with webforms pipeline)
Use generic Control
+
return directly the html (shared with webforms pipeline)
The generic control will redirect to the controller defined in Control Src The generic Control will render the html file defined in Control Src

Why ?

Based on this we can show a clean message if the module do not support the actual page pipeline

Description of alternatives considered

Benefits MVC modules can implement IActionable in a unified way. No modifications to the existing module pipeline. Open to custom custom module control patterns. Inline with the existing IModuleControl of Webforms Inline with .net Core, because there will be no module pipeline (support only for 1 module patern) Cons class config in place of boolean or string constant in module manifest. Not inline with the existing dnn module pipeline

Anything else?

More info about MVC Pipeline

Do you plan to contribute code for this enhancement?

  • [x] Yes

Would you be interested in sponsoring this enhancement?

  • [ ] Yes

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

sachatrauwaen avatar Sep 01 '25 17:09 sachatrauwaen

One quesiton I have with this is that the module process currently supports "mixing" technology within the same individual module. You can have both MVC & WebForms inside of the same module, or even SPA as well, so a flag/identifier at the module level could be misleading?

mitchelsellers avatar Sep 02 '25 03:09 mitchelsellers

Yes and being able for a module to have different views with different technologies might help transition large modules easier...

valadas avatar Sep 02 '25 03:09 valadas

One quesiton I have with this is that the module process currently supports "mixing" technology within the same individual module. You can have both MVC & WebForms inside of the same module, or even SPA as well, so a flag/identifier at the module level could be misleading?

I suppose you meaning, that that one module can have different kind of ModuleControls (spa, mvc, webforms). So, the new settings is also on ModuleControl level, so that is also true here.

The difference with the Webform Module Pipeline, that use the module control src extension to chose the module patern (spa, mvc, webforms is that the responsability of the used module patern depend on the implementation of MvcControlClass.

For the cases of MVC and SPA module patern, that can relay on the same underlaying source on webforms and mvc pipeline, a generic MvcControlClass for spa and an other for MVC can relay on the WebForms Control src to do the rendering.

A littlebit the same happen in the Webforms Modulepipeline, for webforms modules, the IModuleControl is the module control defined in the Control src and for SPA and MVC, IModuleControl is generic.

Is this answering your question ?

sachatrauwaen avatar Sep 02 '25 07:09 sachatrauwaen

Here some extra clarification more specific about mixing mvc and webforms pipeline module controls on a module.

In DNN there are 2 kind of page rendering:

  1. Normal page with multiple module. DNN use the View Control of the module. In the mvc pipeline, all module of the page needs to have the view MvcControlClass defined to be able to render the page correctelly.
  2. Module Control pages (pages with ctrl and mid query parameter in the url) with only one module on the page. DNN use a additional Module Control for this, selected based on the Module Control key. In the mvc pipeline, depending on the presence of a MvcControlClass for this module control, the page will be rendered in the webform or webform pipeline.

sachatrauwaen avatar Sep 03 '25 07:09 sachatrauwaen