From f63514e8ea754e8c0f9a7e181dadc35e7b02b02b Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 11 Jun 2013 09:52:41 +0200 Subject: [PATCH] Web.PublishedCache - add XPathNavigatorIsNavigable to caches --- src/Umbraco.Web/PublishedCache/ContextualPublishedCache.cs | 6 ++++++ .../PublishedCache/ContextualPublishedCacheOfT.cs | 6 ++++++ src/Umbraco.Web/PublishedCache/IPublishedCache.cs | 6 ++++++ .../XmlPublishedCache/PublishedContentCache.cs | 2 ++ .../PublishedCache/XmlPublishedCache/PublishedMediaCache.cs | 2 ++ 5 files changed, 22 insertions(+) diff --git a/src/Umbraco.Web/PublishedCache/ContextualPublishedCache.cs b/src/Umbraco.Web/PublishedCache/ContextualPublishedCache.cs index a4634e5331..b5c3d850d2 100644 --- a/src/Umbraco.Web/PublishedCache/ContextualPublishedCache.cs +++ b/src/Umbraco.Web/PublishedCache/ContextualPublishedCache.cs @@ -201,6 +201,12 @@ namespace Umbraco.Web.PublishedCache /// The XPath navigator. public abstract XPathNavigator GetXPathNavigator(bool preview); + /// + /// Gets a value indicating whether GetXPathNavigator returns an XPathNavigator + /// and that navigator is a NavigableNavigator. + /// + public abstract bool XPathNavigatorIsNavigable { get; } + /// /// Gets a value indicating whether the underlying non-contextual cache contains content. /// diff --git a/src/Umbraco.Web/PublishedCache/ContextualPublishedCacheOfT.cs b/src/Umbraco.Web/PublishedCache/ContextualPublishedCacheOfT.cs index 9e221cbb1a..d759153419 100644 --- a/src/Umbraco.Web/PublishedCache/ContextualPublishedCacheOfT.cs +++ b/src/Umbraco.Web/PublishedCache/ContextualPublishedCacheOfT.cs @@ -132,6 +132,12 @@ namespace Umbraco.Web.PublishedCache return _cache.GetXPathNavigator(UmbracoContext, preview); } + /// + /// Gets a value indicating whether GetXPathNavigator returns an XPathNavigator + /// and that navigator is a NavigableNavigator. + /// + public override bool XPathNavigatorIsNavigable { get { return _cache.XPathNavigatorIsNavigable; } } + /// /// Gets a value indicating whether the underlying non-contextual cache contains content. /// diff --git a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs index 16986f0148..a900689350 100644 --- a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs +++ b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs @@ -88,6 +88,12 @@ namespace Umbraco.Web.PublishedCache /// The value of overrides the context. XPathNavigator GetXPathNavigator(UmbracoContext umbracoContext, bool preview); + /// + /// Gets a value indicating whether GetXPathNavigator returns an XPathNavigator + /// and that navigator is a NavigableNavigator. + /// + bool XPathNavigatorIsNavigable { get; } + /// /// Gets a value indicating whether the cache contains published content. /// diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index df143ed8e3..6b82f278be 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -320,6 +320,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache return xml.CreateNavigator(); } + public virtual bool XPathNavigatorIsNavigable { get { return false; } } + #endregion #region Legacy Xml diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index c0f156de87..03c44f34c9 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -92,6 +92,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache throw new NotImplementedException("PublishedMediaCache does not support XPath."); } + public bool XPathNavigatorIsNavigable { get { return false; } } + public virtual bool HasContent(UmbracoContext context, bool preview) { throw new NotImplementedException(); } private ExamineManager GetExamineManagerSafe()