PublishedContent - use PublishedContentModelFactory in XmlPublishedCache
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Xml.XPath;
|
|||||||
using Umbraco.Core.Logging;
|
using Umbraco.Core.Logging;
|
||||||
using Umbraco.Core;
|
using Umbraco.Core;
|
||||||
using Umbraco.Core.Models;
|
using Umbraco.Core.Models;
|
||||||
|
using Umbraco.Core.Models.PublishedContent;
|
||||||
using Umbraco.Core.Xml;
|
using Umbraco.Core.Xml;
|
||||||
using Umbraco.Web.Routing;
|
using Umbraco.Web.Routing;
|
||||||
using umbraco;
|
using umbraco;
|
||||||
@@ -17,7 +18,6 @@ using umbraco.presentation.preview;
|
|||||||
|
|
||||||
namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||||
{
|
{
|
||||||
// fixme - does not implement the content model factory
|
|
||||||
internal class PublishedContentCache : IPublishedContentCache
|
internal class PublishedContentCache : IPublishedContentCache
|
||||||
{
|
{
|
||||||
#region Routes cache
|
#region Routes cache
|
||||||
@@ -238,12 +238,15 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
|
|
||||||
private static IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
|
private static IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
|
||||||
{
|
{
|
||||||
return xmlNode == null ? null : new XmlPublishedContent(xmlNode, isPreviewing);
|
return xmlNode == null
|
||||||
|
? null
|
||||||
|
: PublishedContentModelFactory.CreateModel(new XmlPublishedContent(xmlNode, isPreviewing));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
|
private static IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
|
||||||
{
|
{
|
||||||
return xmlNodes.Cast<XmlNode>().Select(xmlNode => new XmlPublishedContent(xmlNode, isPreviewing));
|
return xmlNodes.Cast<XmlNode>()
|
||||||
|
.Select(xmlNode => PublishedContentModelFactory.CreateModel(new XmlPublishedContent(xmlNode, isPreviewing)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new DictionaryPublishedContent(values,
|
var content = new DictionaryPublishedContent(values,
|
||||||
d => d.ParentId != -1 //parent should be null if -1
|
d => d.ParentId != -1 //parent should be null if -1
|
||||||
? GetUmbracoMedia(d.ParentId)
|
? GetUmbracoMedia(d.ParentId)
|
||||||
: null,
|
: null,
|
||||||
@@ -249,6 +249,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
d => GetChildrenMedia(d.Id),
|
d => GetChildrenMedia(d.Id),
|
||||||
GetProperty,
|
GetProperty,
|
||||||
true);
|
true);
|
||||||
|
return PublishedContentModelFactory.CreateModel(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IPublishedContent ConvertFromXPathNavigator(XPathNavigator xpath)
|
internal IPublishedContent ConvertFromXPathNavigator(XPathNavigator xpath)
|
||||||
@@ -299,7 +300,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DictionaryPublishedContent(values,
|
var content = new DictionaryPublishedContent(values,
|
||||||
d => d.ParentId != -1 //parent should be null if -1
|
d => d.ParentId != -1 //parent should be null if -1
|
||||||
? GetUmbracoMedia(d.ParentId)
|
? GetUmbracoMedia(d.ParentId)
|
||||||
: null,
|
: null,
|
||||||
@@ -307,6 +308,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
d => GetChildrenMedia(d.Id, xpath),
|
d => GetChildrenMedia(d.Id, xpath),
|
||||||
GetProperty,
|
GetProperty,
|
||||||
false);
|
false);
|
||||||
|
return PublishedContentModelFactory.CreateModel(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
if (parent == null) return;
|
if (parent == null) return;
|
||||||
|
|
||||||
if (parent.Name == "node" || (parent.Attributes != null && parent.Attributes.GetNamedItem("isDoc") != null))
|
if (parent.Name == "node" || (parent.Attributes != null && parent.Attributes.GetNamedItem("isDoc") != null))
|
||||||
_parent = new XmlPublishedContent(parent, _isPreviewing, true);
|
_parent = PublishedContentModelFactory.CreateModel(new XmlPublishedContent(parent, _isPreviewing, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
@@ -439,7 +439,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
|||||||
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);
|
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);
|
||||||
var iterator = nav.Select(expr);
|
var iterator = nav.Select(expr);
|
||||||
while (iterator.MoveNext())
|
while (iterator.MoveNext())
|
||||||
_children.Add(new XmlPublishedContent(((IHasXmlNode)iterator.Current).GetNode(), _isPreviewing, true));
|
_children.Add(PublishedContentModelFactory.CreateModel(
|
||||||
|
new XmlPublishedContent(((IHasXmlNode)iterator.Current).GetNode(), _isPreviewing, true)));
|
||||||
|
|
||||||
// warn: this is not thread-safe
|
// warn: this is not thread-safe
|
||||||
_childrenInitialized = true;
|
_childrenInitialized = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user