DnnMvcBridge

Develop DotNetNuke 7 modules using MVC 4! The DnnMvcBridge has been developed on DotNetNuke 7 but may work on earlier versions from 6.x and up.

This project was inspired by DNN Labs "MVC Module Application Framework" as well as MvcBridge for Umbraco. I borrowed ideas from both of those projects to create DnnMvcBridge.

The DnnMvcBridge does not rely on routes to load the parent controller action, routes are used to load any child actions from there like RenderAction, RenderPartial etc.. from within your views but the default mvc route will handle that just fine.

Given that DotNetNuke does not work off of routes we are utilizing Url Params to load the desired Mvc controller and actions. When the Url Params are not present then the default controller action is used. As a best practice I recommend defining a controller per Dnn module control and only pass the action in the Url and not the controller.

Working from the concept of a "Multi-View" module and a "Single-View" module the DnnMvcBridge does not limit you to one Mvc module per Dnn page but you are limited to one Multi-View module per page but can have many Single-View modules per page. The difference being a Multi-View module will look at the Url params for a action attribute to execute on the controller where a Single-View module will use an action set at design time.

The DnnMvcBridge also includes html helpers for creating Dnn links in your razor views as well as redirects from within your controller actions, i.e RedirectToAction() is replaced with DnnMvcRedirect() which produces a Dnn Url used to execute the Mvc framework Redirect() method within the controller base class giving the developer all the same conveniences they have in Native Mvc apps..

Controller and ViewModel base classes are provided to help keep the executing Page and ModuleInstance in scope within your controller actions as well as in your strongly typed razor views.

You will be pleased to know that filters and model binding all work just the same so that within your strongly typed razor views you can still use all of the out of the box html helper and extensions including validation.

Last edited Feb 5, 2013 at 2:00 AM by jbeckton, version 3