0

I need to create a custom view engine which inherits the RazorViewEngine to implement the concept of sub-areas (plugin architecture).

This means that following view should be possible to obtain: \Areas\NameArea\Areas\SubArea\Views\XXX.cshtml

I have specific route data which tells about the fact that it concerns a sub area.

So if a controller returns View("XXX") the system should be intelligent enough to fetch the file at the right location.

Somewhere there should be a construction to check if it concerns a view in a sub area (through route information which is already in place) and to point to the right path in the folder.

How do I go about this?

stephan.peters
  • 963
  • 13
  • 35

1 Answers1

0

I believe you cant have sub areas....

I have just tried it out, and I couldn't create a sub area

if you do add Areas you need to remember that if in the original _Layout.cshtml if you put a link in it, you need to specify Area in the route values:

@Html.ActionLink("My Link", "Index", "MyController", new { area = "" })
@Html.ActionLink("Create Link", "Create", "MyCreateController", new { area = "MyArea" })
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
  • Yes you can't by default. The question is how to tweak the system so that for view XXX based on route values XXX a full path to the subarea is taken. – stephan.peters Jul 11 '13 at 12:42