Refactor PublishedContentModelFactory

This commit is contained in:
Stephan
2014-05-18 21:23:09 +02:00
parent f8d7aeec80
commit 28da44f0de
8 changed files with 31 additions and 31 deletions

View File

@@ -242,13 +242,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
return xmlNode == null
? null
: PublishedContentModelFactory.CreateModel(new XmlPublishedContent(xmlNode, isPreviewing));
: (new XmlPublishedContent(xmlNode, isPreviewing)).CreateModel2();
}
private static IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
{
return xmlNodes.Cast<XmlNode>()
.Select(xmlNode => PublishedContentModelFactory.CreateModel(new XmlPublishedContent(xmlNode, isPreviewing)));
.Select(xmlNode => (new XmlPublishedContent(xmlNode, isPreviewing)).CreateModel2());
}
#endregion

View File

@@ -255,7 +255,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
d => GetChildrenMedia(d.Id),
GetProperty,
true);
return PublishedContentModelFactory.CreateModel(content);
return content.CreateModel2();
}
internal IPublishedContent ConvertFromXPathNavigator(XPathNavigator xpath)
@@ -314,7 +314,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
d => GetChildrenMedia(d.Id, xpath),
GetProperty,
false);
return PublishedContentModelFactory.CreateModel(content);
return content.CreateModel2();
}
/// <summary>

View File

@@ -338,7 +338,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (parent == null) return;
if (parent.Name == "node" || (parent.Attributes != null && parent.Attributes.GetNamedItem("isDoc") != null))
_parent = PublishedContentModelFactory.CreateModel(new XmlPublishedContent(parent, _isPreviewing, true));
_parent = (new XmlPublishedContent(parent, _isPreviewing, true)).CreateModel2();
}
private void Initialize()
@@ -439,8 +439,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);
var iterator = nav.Select(expr);
while (iterator.MoveNext())
_children.Add(PublishedContentModelFactory.CreateModel(
new XmlPublishedContent(((IHasXmlNode)iterator.Current).GetNode(), _isPreviewing, true)));
_children.Add(
(new XmlPublishedContent(((IHasXmlNode)iterator.Current).GetNode(), _isPreviewing, true)).CreateModel2());
// warn: this is not thread-safe
_childrenInitialized = true;