diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs index 71e81c7c77..4536d34d40 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs @@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing var result = lookup.TryFindDocument(docRequest); Assert.IsTrue(result); - Assert.AreEqual(docRequest.PublishedContentId, nodeMatch); + Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs index 7981a9f06b..5a4b51082e 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs @@ -30,7 +30,7 @@ namespace Umbraco.Tests.Routing var result = lookup.TryFindDocument(docRequest); Assert.IsTrue(result); - Assert.AreEqual(docRequest.PublishedContentId, nodeMatch); + Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs index 6bb9ef3fdb..286fa7a122 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs @@ -48,7 +48,7 @@ namespace Umbraco.Tests.Routing if (expectedId > 0) { Assert.IsTrue(result); - Assert.AreEqual(expectedId, docreq.PublishedContentId); + Assert.AreEqual(expectedId, docreq.PublishedContent.Id); } else { @@ -73,7 +73,7 @@ namespace Umbraco.Tests.Routing var result = lookup.TryFindDocument(docreq); Assert.IsTrue(result); - Assert.AreEqual(expectedId, docreq.PublishedContentId); + Assert.AreEqual(expectedId, docreq.PublishedContent.Id); } } diff --git a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs index 2897e9662d..0ad0270e18 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs @@ -166,7 +166,7 @@ namespace Umbraco.Tests.Routing var lookup = new ContentFinderByNiceUrl(); var result = lookup.TryFindDocument(pcr); Assert.IsTrue(result); - Assert.AreEqual(expectedId, pcr.PublishedContentId); + Assert.AreEqual(expectedId, pcr.PublishedContent.Id); } [TestCase("http://domain1.com/", 1001, "en-US")] @@ -205,7 +205,7 @@ namespace Umbraco.Tests.Routing var lookup = new ContentFinderByNiceUrl(); var result = lookup.TryFindDocument(pcr); Assert.IsTrue(result); - Assert.AreEqual(expectedId, pcr.PublishedContentId); + Assert.AreEqual(expectedId, pcr.PublishedContent.Id); } } } diff --git a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs index 5d96feec07..b82e25e020 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs @@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing var result = lookup.TryFindDocument(docRequest); Assert.IsTrue(result); - Assert.AreEqual(docRequest.PublishedContentId, nodeMatch); + Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 2f0c4a04c4..c5ab12c68f 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -51,7 +51,7 @@ namespace Umbraco.Tests.Routing var lookup = new ContentFinderByNiceUrl(); var result = lookup.TryFindDocument(pcr); Assert.IsTrue(result); - Assert.AreEqual(100111, pcr.PublishedContentId); + Assert.AreEqual(100111, pcr.PublishedContent.Id); // has the cache been polluted? cachedRoutes = ((DefaultRoutesCache)routingContext.UmbracoContext.RoutesCache).GetCachedRoutes(); diff --git a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs index 7442bfd2e7..54d21d4477 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Routing if (node != null) { docRequest.PublishedContent = node; - LogHelper.Debug("Found node with id={0}", () => docRequest.PublishedContentId); + LogHelper.Debug("Found node with id={0}", () => docRequest.PublishedContent.Id); } else { diff --git a/src/Umbraco.Web/Routing/ContentFinderByNiceUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByNiceUrl.cs index 06b016de03..c706476fb9 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByNiceUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByNiceUrl.cs @@ -79,7 +79,7 @@ namespace Umbraco.Web.Routing if (node != null) { docreq.PublishedContent = node; - LogHelper.Debug("Query matches, id={0}", () => docreq.PublishedContentId); + LogHelper.Debug("Query matches, id={0}", () => docreq.PublishedContent.Id); var iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path); if (!iscanon) @@ -87,7 +87,7 @@ namespace Umbraco.Web.Routing // do not store if previewing or if non-canonical if (!docreq.RoutingContext.UmbracoContext.InPreviewMode && iscanon) - docreq.RoutingContext.UmbracoContext.RoutesCache.Store(docreq.PublishedContentId, route); + docreq.RoutingContext.UmbracoContext.RoutesCache.Store(docreq.PublishedContent.Id, route); } else diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index baa1fa809c..1442642e6f 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.Routing if (node != null) { docRequest.PublishedContent = node; - LogHelper.Debug("Path \"{0}\" is an alias for id={1}", () => docRequest.Uri.AbsolutePath, () => docRequest.PublishedContentId); + LogHelper.Debug("Path \"{0}\" is an alias for id={1}", () => docRequest.Uri.AbsolutePath, () => docRequest.PublishedContent.Id); } } diff --git a/src/Umbraco.Web/Routing/PublishedContentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs index 90a6b10a01..7aeb79902b 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -145,20 +145,6 @@ namespace Umbraco.Web.Routing set { _initialPublishedContent = _publishedContent; } } - /// - /// Gets the identifier of the requested content. - /// - /// Thrown when the content request has no content. - public int PublishedContentId - { - get - { - if (this.PublishedContent == null) - throw new InvalidOperationException("PublishedContentRequest has no document."); - return _publishedContentId; - } - } - /// /// Gets a value indicating whether the content request has a content. /// diff --git a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs index 8297a18d2a..c15ee5825d 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs @@ -104,7 +104,7 @@ namespace Umbraco.Web.Routing _pcr.UmbracoPage = new page(_pcr); // these two are used by many legacy objects - _routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContentId; + _routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id; _routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements; } @@ -148,7 +148,7 @@ namespace Umbraco.Web.Routing _pcr.UmbracoPage = new page(_pcr); // these two are used by many legacy objects - _routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContentId; + _routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id; _routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements; } @@ -455,7 +455,7 @@ namespace Umbraco.Web.Routing //_pcr.Document = null; // no! that would be to force a 404 LogHelper.Debug("{0}Failed to redirect to id={1}: invalid value", () => tracePrefix, () => internalRedirect); } - else if (internalRedirectId == _pcr.PublishedContentId) + else if (internalRedirectId == _pcr.PublishedContent.Id) { // redirect to self LogHelper.Debug("{0}Redirecting to self, ignore", () => tracePrefix); @@ -494,7 +494,7 @@ namespace Umbraco.Web.Routing var path = _pcr.PublishedContent.Path; - if (Access.IsProtected(_pcr.PublishedContentId, path)) + if (Access.IsProtected(_pcr.PublishedContent.Id, path)) { LogHelper.Debug("{0}Page is protected, check for access", () => tracePrefix); @@ -512,14 +512,14 @@ namespace Umbraco.Web.Routing { LogHelper.Debug("{0}Not logged in, redirect to login page", () => tracePrefix); var loginPageId = Access.GetLoginPage(path); - if (loginPageId != _pcr.PublishedContentId) + if (loginPageId != _pcr.PublishedContent.Id) _pcr.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById(_routingContext.UmbracoContext, loginPageId); } - else if (!Access.HasAccces(_pcr.PublishedContentId, user.ProviderUserKey)) + else if (!Access.HasAccces(_pcr.PublishedContent.Id, user.ProviderUserKey)) { LogHelper.Debug("{0}Current member has not access, redirect to error page", () => tracePrefix); var errorPageId = Access.GetErrorPage(path); - if (errorPageId != _pcr.PublishedContentId) + if (errorPageId != _pcr.PublishedContent.Id) _pcr.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById(_routingContext.UmbracoContext, errorPageId); } else diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index b12d33c890..d4ec67ba19 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -168,7 +168,7 @@ namespace Umbraco.Web.Templates // handlers like default.aspx will want it and most macros currently need it contentRequest.UmbracoPage = new page(contentRequest); //now, set the new ones for this page execution - _umbracoContext.HttpContext.Items["pageID"] = contentRequest.PublishedContentId; + _umbracoContext.HttpContext.Items["pageID"] = contentRequest.PublishedContent.Id; _umbracoContext.HttpContext.Items["pageElements"] = contentRequest.UmbracoPage.Elements; _umbracoContext.HttpContext.Items["altTemplate"] = null; _umbracoContext.PublishedContentRequest = contentRequest; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs index be350419de..30dbe63c58 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery-Nodes.cs @@ -213,7 +213,7 @@ namespace umbraco // partially prepare the request: do _not_ follow redirects, handle 404, nothing - just find a content pcr.Engine.FindDomain(); pcr.Engine.FindPublishedContent(); - return pcr.HasPublishedContent ? pcr.PublishedContentId : uQuery.RootNodeId; + return pcr.HasPublishedContent ? pcr.PublishedContent.Id : uQuery.RootNodeId; } ///