This is what I would recommend. I would just structure my views in the core project in a manner to accomplish what you want. Come up with a naming convention for your views for use and then create controls or partial views for reuse.
I would then leverage the IViewLocator interface to change where to look for the views. After that, you can set your ViewLocator when you create your controller using the unity logic you put in, based on the criteria you want to use.
First, you will want to create a ViewLocator based on the structure you came up with.
public class CustomViewLocator : ViewLocator
{
private string _area;
public CustomViewLocator(string area)
{
_area = area;
}
protected override string GetMasterLocation(RequestContext requestContext, string masterName)
{
RegisterMasterLocationFormats();
return base.GetMasterLocation(requestContext, masterName);
}
protected override string GetViewLocation(RequestContext requestContext, string viewName)
{
RegisterViewLocationFormats();
return base.GetViewLocation(requestContext, viewName);
}
private void RegisterViewLocationFormats()
{
if (!String.IsNullOrEmpty(_area))
{
ViewLocationFormats = new[]
{
"~/Views/" + _area + "/{1}/{0}.aspx",
"~/Views/" + _area + "/{1}/{0}.ascx"
};
}
}
private void RegisterMasterLocationFormats()
{
if (!String.IsNullOrEmpty(_area))
{
MasterLocationFormats = new[]
{
"~/Views/" + _area + "/{1}/{0}.master",
"~/Views/" + _area + "/Layouts/{0}.master"
};
}
}
}
Then in your ControllerFactory, inside the CreateController method that you are using with unity, use this line to set your ViewLocator for the controller.
public IController CreateController(RequestContext context, string controllerName)
{
var controller = null; // Unity logic to retrieve controller.
// Set the ViewLocator
if (controller != null)
((WebFormViewEngine)controller.ViewEngine).ViewLocator = new CustomViewLocator("Structure1");
return controller;
}
Right now there really isn't a good way to implement what you want, but what I outlined above is probably the simplest route.