Changed the Template prop of documentrequest to be a new TemplateLookup object since we are going
to need to support MVC and the old Template object is for webforms. I've added a lot of TODO's here because we'll need to enable the lookups properly in each ILookup and also set the rendering engine (IsMvc) in the ILookups too. This hasn't been enabled, yet, just a bunch of TODO's written.
This commit is contained in:
@@ -18,6 +18,56 @@ using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Represents a found template that is resolved by the ILookups.
|
||||
/// The TemplateObject is the business logic object that represents a template, this will be different for
|
||||
/// web forms and MVC.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// NOTE: This is not the prettiest thing in the world and we cannot use generics but we need to avoid looking up
|
||||
/// template objects more than once which would occur if we were only storing the alias.
|
||||
/// Once we take templates out of the db this becomes even more interesting because the templateId on the XML
|
||||
/// will probably not be an integer Id anymore but more like an alias so the reprecussions will be big.
|
||||
/// </remarks>
|
||||
internal class TemplateLookup
|
||||
{
|
||||
/// <summary>
|
||||
/// Static method to return an empty template lookup
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static TemplateLookup NoTemplate()
|
||||
{
|
||||
return new TemplateLookup();
|
||||
}
|
||||
|
||||
private TemplateLookup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal TemplateLookup(string alias, object templateObject)
|
||||
{
|
||||
TemplateAlias = alias;
|
||||
TemplateObject = templateObject;
|
||||
}
|
||||
|
||||
internal bool FoundTemplate
|
||||
{
|
||||
get { return TemplateObject != null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The alias of the template found
|
||||
/// </summary>
|
||||
internal string TemplateAlias { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The business logic template object that has been found, null if not found
|
||||
/// </summary>
|
||||
internal object TemplateObject { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// represents a request for one specified Umbraco document to be rendered
|
||||
/// by one specified template, using one particular culture.
|
||||
@@ -61,6 +111,11 @@ namespace Umbraco.Web.Routing
|
||||
|
||||
public Uri DomainUri { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the rendering engine is MVC or WebForms
|
||||
/// </summary>
|
||||
public bool IsMvc { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the document request has a domain.
|
||||
/// </summary>
|
||||
@@ -83,22 +138,22 @@ namespace Umbraco.Web.Routing
|
||||
set
|
||||
{
|
||||
_node = value;
|
||||
this.Template = null;
|
||||
this.TemplateLookup = null;
|
||||
_nodeId = _node != null ? _node.Id : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the document request's template.
|
||||
/// Gets or sets the document request's template lookup
|
||||
/// </summary>
|
||||
public Template Template { get; set; }
|
||||
public TemplateLookup TemplateLookup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the document request has a template.
|
||||
/// </summary>
|
||||
public bool HasTemplate
|
||||
{
|
||||
get { return this.Template != null; }
|
||||
get { return this.TemplateLookup != null && TemplateLookup.FoundTemplate; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user