So it looks like there are at least a couple people out there who have used DD4T with MVC5. Has anyone used it with MVC 5 Areas though? What were the issues? It seems like the additional area routes may be an issue. I am about to see how big of a concern this is, but if someone else has already gone through the pain I would like to learn from that.
This is not as straight forward as I think people are assuming and is related to DD4T unless I am missing something.
More details: DD4T defines this route
// Tridion page route
routes.MapRoute(
"TridionPage",
"{*PageId}",
new { controller = "Page", action = "Page" }, // Parameter defaults
new { pageId = @"^(.*)?$" }); // Parameter constraints
and you have this type of folder structure for it.
All is good. Now you want to add an area. So you use the VS scaffolding to say add area. You now have this folder structure.
I also register a new route.
// Tridion page route
context.MapRoute(
"TridionPageTest",
"Test/{*PageId}",
new { controller = "Page", action = "Page" }, // Parameter defaults
new { pageId = @"^(.*)?$" },
new[] { "<namespace>.Web.Controllers.Test" }); // Parameter constraints
Notice that I add a namespace to my route to separate my area controllers from my default controllers.
Run the code by going to http:///Test and the PageController in my Test area is hit. So all is good.
The issue is when the base.Page(pageId) method is called it returns index.aspx page from the Broker. This has a view on it of "Default" which DD4T then load the Default.cshtml view from the root and not the area. Then the default view tries to load and does but calles
@Html.RenderComponentPresentations()
IN DD4T code calls DefaultComponentPresentationRender.RenderComponentPresentation method there is this call. controller = ConfigurationHelper.ComponentPresentationController.
Which under the covers in DD4T is always mapped to the one ComponentController in the config file. So since DD4T is forcing the use of some controllers I am not sure it is as simple as " there would be no relationship between DD4T and your MVC Areas; they would be completely independent."
Add Scaffold
dialog and roughly represent website "sections" or maybe types of pages. @AntP, any thoughts on a relationship to Tridion Structure Groups or Page Types for MVC areas, perhaps? Or would the use of areas be up to development?