diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index 2a6739df38..11fb55f9b3 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -84,7 +84,7 @@ namespace Umbraco.Tests.Cache.PublishedCache globalSettings, new TestVariationContextAccessor()); - _cache = _umbracoContext.ContentCache; + _cache = _umbracoContext.Content; } [Test] diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs index acbad002ee..ced4c012f8 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs @@ -27,7 +27,7 @@ namespace Umbraco.Tests.PublishedContent { InitializeInheritedContentTypes(); - var publishedContent = _ctx.ContentCache.GetById(1100); + var publishedContent = _ctx.Content.GetById(1100); Assert.That(publishedContent.IsDocumentType("inherited", false)); } @@ -36,7 +36,7 @@ namespace Umbraco.Tests.PublishedContent { InitializeInheritedContentTypes(); - var publishedContent = _ctx.ContentCache.GetById(1100); + var publishedContent = _ctx.Content.GetById(1100); Assert.That(publishedContent.IsDocumentType("base", false), Is.False); } @@ -45,7 +45,7 @@ namespace Umbraco.Tests.PublishedContent { InitializeInheritedContentTypes(); - var publishedContent = _ctx.ContentCache.GetById(1100); + var publishedContent = _ctx.Content.GetById(1100); Assert.That(publishedContent.IsDocumentType("inherited", true)); } @@ -55,7 +55,7 @@ namespace Umbraco.Tests.PublishedContent InitializeInheritedContentTypes(); ContentTypesCache.GetPublishedContentTypeByAlias = null; - var publishedContent = _ctx.ContentCache.GetById(1100); + var publishedContent = _ctx.Content.GetById(1100); Assert.That(publishedContent.IsDocumentType("base", true)); } @@ -64,7 +64,7 @@ namespace Umbraco.Tests.PublishedContent { InitializeInheritedContentTypes(); - var publishedContent = _ctx.ContentCache.GetById(1100); + var publishedContent = _ctx.Content.GetById(1100); Assert.That(publishedContent.IsDocumentType("invalidbase", true), Is.False); } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs index 4fe028b1db..dc726c5748 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs @@ -191,7 +191,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_For_Populated_Requested_Language() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "en-US"); Assert.AreEqual("Welcome", value); } @@ -199,7 +199,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_For_Populated_Requested_Non_Default_Language() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "de"); Assert.AreEqual("Willkommen", value); } @@ -207,7 +207,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Do_Not_Get_Content_For_Unpopulated_Requested_Language_Without_Fallback() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "fr"); Assert.IsNull(value); } @@ -215,7 +215,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Do_Not_Get_Content_For_Unpopulated_Requested_Language_With_Fallback_Unless_Requested() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "es"); Assert.IsNull(value); } @@ -223,7 +223,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_For_Unpopulated_Requested_Language_With_Fallback() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "es", fallback: Fallback.ToLanguage); Assert.AreEqual("Welcome", value); } @@ -231,7 +231,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_For_Unpopulated_Requested_Language_With_Fallback_Over_Two_Levels() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "it", fallback: Fallback.To(Fallback.Language, Fallback.Ancestors)); Assert.AreEqual("Welcome", value); } @@ -239,7 +239,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Do_Not_GetContent_For_Unpopulated_Requested_Language_With_Fallback_Over_That_Loops() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); var value = content.Value("welcomeText", "no", fallback: Fallback.ToLanguage); Assert.IsNull(value); } @@ -247,7 +247,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Do_Not_Get_Content_Recursively_Unless_Requested() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); var value = content.Value("welcomeText2"); Assert.IsNull(value); } @@ -255,7 +255,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_Recursively() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); var value = content.Value("welcomeText2", fallback: Fallback.ToAncestors); Assert.AreEqual("Welcome", value); } @@ -263,7 +263,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Do_Not_Get_Content_Recursively_Unless_Requested2() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First().Children().First(); Assert.IsNull(content.GetProperty("welcomeText2")); var value = content.Value("welcomeText2"); Assert.IsNull(value); @@ -272,7 +272,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_Recursively2() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First().Children().First(); Assert.IsNull(content.GetProperty("welcomeText2")); var value = content.Value("welcomeText2", fallback: Fallback.ToAncestors); Assert.AreEqual("Welcome", value); @@ -281,7 +281,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_Recursively3() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First().Children().First(); Assert.IsNull(content.GetProperty("noprop")); var value = content.Value("noprop", fallback: Fallback.ToAncestors); // property has no value but we still get the value (ie, the converter would do something) @@ -292,7 +292,7 @@ namespace Umbraco.Tests.PublishedContent public void Can_Get_Content_With_Recursive_Priority() { Current.VariationContextAccessor.VariationContext = new VariationContext("nl"); - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); var value = content.Value("welcomeText", "nl", fallback: Fallback.To(Fallback.Ancestors, Fallback.Language)); @@ -303,7 +303,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Get_Content_With_Fallback_Language_Priority() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); var value = content.Value("welcomeText", "nl", fallback: Fallback.ToLanguage); // No Dutch value is directly assigned. Check has fallen back to English value from language variant. @@ -313,14 +313,14 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Throws_For_Non_Supported_Fallback() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); Assert.Throws(() => content.Value("welcomeText", "nl", fallback: Fallback.To(999))); } [Test] public void Can_Fallback_To_Default_Value() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); // no Dutch value is assigned, so getting null var value = content.Value("welcomeText", "nl"); @@ -338,7 +338,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Can_Have_Custom_Default_Value() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First().Children().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First().Children().First(); // HACK: the value, pretend the converter would return something var prop = content.GetProperty("welcomeText") as SolidPublishedPropertyWithLanguageVariants; diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 378671b81b..abd4771547 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -101,14 +101,14 @@ namespace Umbraco.Tests.PublishedContent [Test] public void First() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot().First(); + var content = Current.UmbracoContext.Content.GetAtRoot().First(); Assert.AreEqual("Content 1", content.Name()); } [Test] public void Distinct() { - var items = Current.UmbracoContext.ContentCache.GetAtRoot() + var items = Current.UmbracoContext.Content.GetAtRoot() .Distinct() .Distinct() .ToIndexedArray(); @@ -132,7 +132,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void OfType1() { - var items = Current.UmbracoContext.ContentCache.GetAtRoot() + var items = Current.UmbracoContext.Content.GetAtRoot() .OfType() .Distinct() .ToIndexedArray(); @@ -143,7 +143,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void OfType2() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot() + var content = Current.UmbracoContext.Content.GetAtRoot() .OfType() .Distinct() .ToIndexedArray(); @@ -154,7 +154,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void OfType() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot() + var content = Current.UmbracoContext.Content.GetAtRoot() .OfType() .First(x => x.Prop1 == 1234); Assert.AreEqual("Content 2", content.Name()); @@ -164,7 +164,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Position() { - var items = Current.UmbracoContext.ContentCache.GetAtRoot() + var items = Current.UmbracoContext.Content.GetAtRoot() .Where(x => x.Value("prop1") == 1234) .ToIndexedArray(); @@ -179,7 +179,7 @@ namespace Umbraco.Tests.PublishedContent [Test] public void Issue() { - var content = Current.UmbracoContext.ContentCache.GetAtRoot() + var content = Current.UmbracoContext.Content.GetAtRoot() .Distinct() .OfType(); @@ -187,12 +187,12 @@ namespace Umbraco.Tests.PublishedContent var first = where.First(); Assert.AreEqual(1234, first.Prop1); - var content2 = Current.UmbracoContext.ContentCache.GetAtRoot() + var content2 = Current.UmbracoContext.Content.GetAtRoot() .OfType() .First(x => x.Prop1 == 1234); Assert.AreEqual(1234, content2.Prop1); - var content3 = Current.UmbracoContext.ContentCache.GetAtRoot() + var content3 = Current.UmbracoContext.Content.GetAtRoot() .OfType() .First(); Assert.AreEqual(1234, content3.Prop1); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index 4472842251..fd0837b0ab 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -142,7 +142,7 @@ namespace Umbraco.Tests.PublishedContent internal IPublishedContent GetNode(int id) { var ctx = GetUmbracoContext("/test"); - var doc = ctx.ContentCache.GetById(id); + var doc = ctx.Content.GetById(id); Assert.IsNotNull(doc); return doc; } @@ -151,16 +151,16 @@ namespace Umbraco.Tests.PublishedContent public void GetNodeByIds() { var ctx = GetUmbracoContext("/test"); - var contentById = ctx.ContentCache.GetById(1173); + var contentById = ctx.Content.GetById(1173); Assert.IsNotNull(contentById); - var contentByGuid = ctx.ContentCache.GetById(_node1173Guid); + var contentByGuid = ctx.Content.GetById(_node1173Guid); Assert.IsNotNull(contentByGuid); Assert.AreEqual(contentById.Id, contentByGuid.Id); Assert.AreEqual(contentById.Key, contentByGuid.Key); - contentById = ctx.ContentCache.GetById(666); + contentById = ctx.Content.GetById(666); Assert.IsNull(contentById); - contentByGuid = ctx.ContentCache.GetById(Guid.NewGuid()); + contentByGuid = ctx.Content.GetById(Guid.NewGuid()); Assert.IsNull(contentByGuid); } diff --git a/src/Umbraco.Tests/PublishedContent/RootNodeTests.cs b/src/Umbraco.Tests/PublishedContent/RootNodeTests.cs index 0af30b4642..be94923ad0 100644 --- a/src/Umbraco.Tests/PublishedContent/RootNodeTests.cs +++ b/src/Umbraco.Tests/PublishedContent/RootNodeTests.cs @@ -13,17 +13,17 @@ namespace Umbraco.Tests.PublishedContent var ctx = GetUmbracoContext("/test"); // there is no content node with ID -1 - var content = ctx.ContentCache.GetById(-1); + var content = ctx.Content.GetById(-1); Assert.IsNull(content); // content at root has null parent - content = ctx.ContentCache.GetById(1046); + content = ctx.Content.GetById(1046); Assert.IsNotNull(content); Assert.AreEqual(1, content.Level); Assert.IsNull(content.Parent()); // non-existing content is null - content = ctx.ContentCache.GetById(666); + content = ctx.Content.GetById(666); Assert.IsNull(content); } diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs index f1f38504f1..935417c510 100644 --- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs +++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs @@ -100,7 +100,7 @@ namespace Umbraco.Tests.Routing var umbracoContext = GetUmbracoContext("~/dummy-page", template.Id, routeData); var publishedRouter = CreatePublishedRouter(); var frequest = publishedRouter.CreateRequest(umbracoContext); - frequest.PublishedContent = umbracoContext.ContentCache.GetById(1174); + frequest.PublishedContent = umbracoContext.Content.GetById(1174); frequest.TemplateModel = template; var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext); @@ -136,7 +136,7 @@ namespace Umbraco.Tests.Routing var umbracoContext = GetUmbracoContext("~/dummy-page", template.Id, routeData, true); var publishedRouter = CreatePublishedRouter(); var frequest = publishedRouter.CreateRequest(umbracoContext); - frequest.PublishedContent = umbracoContext.ContentCache.GetById(1172); + frequest.PublishedContent = umbracoContext.Content.GetById(1172); frequest.TemplateModel = template; var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext); diff --git a/src/Umbraco.Tests/Routing/UrlProviderTests.cs b/src/Umbraco.Tests/Routing/UrlProviderTests.cs index 38ef983120..3f39e4d4e8 100644 --- a/src/Umbraco.Tests/Routing/UrlProviderTests.cs +++ b/src/Umbraco.Tests/Routing/UrlProviderTests.cs @@ -78,7 +78,7 @@ namespace Umbraco.Tests.Routing Assert.AreEqual(randomSample.Value, result); } - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); Assert.AreEqual(8, cachedRoutes.Count); diff --git a/src/Umbraco.Tests/Routing/UrlRoutesTests.cs b/src/Umbraco.Tests/Routing/UrlRoutesTests.cs index 2e944211ca..4b8d708df6 100644 --- a/src/Umbraco.Tests/Routing/UrlRoutesTests.cs +++ b/src/Umbraco.Tests/Routing/UrlRoutesTests.cs @@ -200,7 +200,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(hide); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings: globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var route = cache.GetRouteById(false, id); @@ -224,7 +224,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(hide); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings: globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var route = cache.GetRouteById(false, id); @@ -238,7 +238,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings:globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var route = cache.GetRouteById(false, 1000); @@ -269,7 +269,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(hide); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings:globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); const bool preview = false; // make sure we don't cache - but HOW? should be some sort of switch?! @@ -300,7 +300,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(hide); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings:globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); const bool preview = false; // make sure we don't cache - but HOW? should be some sort of switch?! @@ -323,7 +323,7 @@ DetermineRouteById(id): globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); var umbracoContext = GetUmbracoContext("/test", 0, globalSettings:globalSettings.Object); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var content = cache.GetByRoute(false, "/a/b/c"); diff --git a/src/Umbraco.Tests/Routing/UrlsProviderWithDomainsTests.cs b/src/Umbraco.Tests/Routing/UrlsProviderWithDomainsTests.cs index 5a20d4da31..583d264f57 100644 --- a/src/Umbraco.Tests/Routing/UrlsProviderWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/UrlsProviderWithDomainsTests.cs @@ -307,7 +307,7 @@ namespace Umbraco.Tests.Routing ignore = umbracoContext.UrlProvider.GetUrl(100111, false, current: new Uri("http://domain2.com")); ignore = umbracoContext.UrlProvider.GetUrl(1002, false, current: new Uri("http://domain2.com")); - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); Assert.AreEqual(7, cachedRoutes.Count); diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 0eb621bd93..d50f2ee687 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -47,7 +47,7 @@ namespace Umbraco.Tests.Routing Assert.AreEqual("http://domain2.com/1001-1-1/", umbracoContext.UrlProvider.GetUrl(100111, true)); // check that the proper route has been cached - var cache = umbracoContext.ContentCache as PublishedContentCache; + var cache = umbracoContext.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs index 9f57109329..46e78eb26b 100644 --- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs +++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs @@ -184,11 +184,11 @@ namespace Umbraco.Tests.Runtimes var umbracoContext = umbracoContextReference.UmbracoContext; // assert that there is no published document - var pcontent = umbracoContext.ContentCache.GetById(content.Id); + var pcontent = umbracoContext.Content.GetById(content.Id); Assert.IsNull(pcontent); // but a draft document - pcontent = umbracoContext.ContentCache.GetById(true, content.Id); + pcontent = umbracoContext.Content.GetById(true, content.Id); Assert.IsNotNull(pcontent); Assert.AreEqual("test", pcontent.Name()); Assert.IsTrue(pcontent.IsDraft()); @@ -202,7 +202,7 @@ namespace Umbraco.Tests.Runtimes contentService.Save(content); // assert that snapshot has been updated and there is now a published document - pcontent = umbracoContext.ContentCache.GetById(content.Id); + pcontent = umbracoContext.Content.GetById(content.Id); Assert.IsNotNull(pcontent); Assert.AreEqual("test", pcontent.Name()); Assert.IsFalse(pcontent.IsDraft()); @@ -211,7 +211,7 @@ namespace Umbraco.Tests.Runtimes Assert.AreEqual("/test/", pcontent.Url()); // and also an updated draft document - pcontent = umbracoContext.ContentCache.GetById(true, content.Id); + pcontent = umbracoContext.Content.GetById(true, content.Id); Assert.IsNotNull(pcontent); Assert.AreEqual("testx", pcontent.Name()); Assert.IsTrue(pcontent.IsDraft()); diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs index f0efffc2cc..4f297b894b 100644 --- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs @@ -148,7 +148,7 @@ namespace Umbraco.Tests.Scoping { evented++; - var e = umbracoContext.ContentCache.GetById(item.Id); + var e = umbracoContext.Content.GetById(item.Id); // during events, due to LiveSnapshot, we see the changes Assert.IsNotNull(e); @@ -162,7 +162,7 @@ namespace Umbraco.Tests.Scoping } // been created - var x = umbracoContext.ContentCache.GetById(item.Id); + var x = umbracoContext.Content.GetById(item.Id); Assert.IsNotNull(x); Assert.AreEqual("name", x.Name()); @@ -184,7 +184,7 @@ namespace Umbraco.Tests.Scoping // after the scope, // if completed, we see the changes // else changes have been rolled back - x = umbracoContext.ContentCache.GetById(item.Id); + x = umbracoContext.Content.GetById(item.Id); Assert.IsNotNull(x); Assert.AreEqual(complete ? "changed" : "name", x.Name()); } diff --git a/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs b/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs index 044965bc79..34482a79fa 100644 --- a/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs @@ -75,7 +75,7 @@ namespace Umbraco.Tests.Scoping private static XmlStore XmlStore => (Current.Factory.GetInstance() as PublishedSnapshotService).XmlStore; private static XmlDocument XmlMaster => XmlStore.Xml; - private static XmlDocument XmlInContext => ((PublishedContentCache) Umbraco.Web.Composing.Current.UmbracoContext.ContentCache).GetXml(false); + private static XmlDocument XmlInContext => ((PublishedContentCache) Umbraco.Web.Composing.Current.UmbracoContext.Content).GetXml(false); [TestCase(true)] [TestCase(false)] @@ -85,7 +85,7 @@ namespace Umbraco.Tests.Scoping // sanity checks Assert.AreSame(umbracoContext, Umbraco.Web.Composing.Current.UmbracoContext); - Assert.AreSame(XmlStore, ((PublishedContentCache) umbracoContext.ContentCache).XmlStore); + Assert.AreSame(XmlStore, ((PublishedContentCache) umbracoContext.Content).XmlStore); // create document type, document var contentType = new ContentType(-1) { Alias = "CustomDocument", Name = "Custom Document" }; @@ -199,7 +199,7 @@ namespace Umbraco.Tests.Scoping // sanity checks Assert.AreSame(umbracoContext, Umbraco.Web.Composing.Current.UmbracoContext); - Assert.AreSame(XmlStore, ((PublishedContentCache)umbracoContext.ContentCache).XmlStore); + Assert.AreSame(XmlStore, ((PublishedContentCache)umbracoContext.Content).XmlStore); // create document type var contentType = new ContentType(-1) { Alias = "CustomDocument", Name = "Custom Document" }; diff --git a/src/Umbraco.Web.UI/config/splashes/NoNodes.aspx.cs b/src/Umbraco.Web.UI/config/splashes/NoNodes.aspx.cs index 38f6793fbe..51653d54ca 100644 --- a/src/Umbraco.Web.UI/config/splashes/NoNodes.aspx.cs +++ b/src/Umbraco.Web.UI/config/splashes/NoNodes.aspx.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.UI.Config.Splashes { base.OnInit(e); - var store = Current.UmbracoContext.ContentCache; + var store = Current.UmbracoContext.Content; if (store.HasContent()) { //if there is actually content, go to the root diff --git a/src/Umbraco.Web/Editors/MacroRenderingController.cs b/src/Umbraco.Web/Editors/MacroRenderingController.cs index 0c3b1626d0..d182a32ade 100644 --- a/src/Umbraco.Web/Editors/MacroRenderingController.cs +++ b/src/Umbraco.Web/Editors/MacroRenderingController.cs @@ -104,7 +104,7 @@ namespace Umbraco.Web.Editors if (m == null) throw new HttpResponseException(HttpStatusCode.NotFound); - var publishedContent = UmbracoContext.ContentCache.GetById(true, pageId); + var publishedContent = UmbracoContext.Content.GetById(true, pageId); //if it isn't supposed to be rendered in the editor then return an empty string //currently we cannot render a macro if the page doesn't yet exist diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index 9736aa283b..61b2f0bda3 100755 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -439,7 +439,7 @@ namespace Umbraco.Web.Macros // this was, and still is, an ugly piece of nonsense var value = string.Empty; - var cache = _umbracoContextAccessor.UmbracoContext.ContentCache; + var cache = _umbracoContextAccessor.UmbracoContext.Content; var splitpath = (string[])pageElements["splitpath"]; for (var i = splitpath.Length - 1; i > 0; i--) // at 0 we have root (-1) diff --git a/src/Umbraco.Web/Mvc/RedirectToUmbracoPageResult.cs b/src/Umbraco.Web/Mvc/RedirectToUmbracoPageResult.cs index 52d168620b..437eec4e5c 100644 --- a/src/Umbraco.Web/Mvc/RedirectToUmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/RedirectToUmbracoPageResult.cs @@ -56,7 +56,7 @@ namespace Umbraco.Web.Mvc if (_publishedContent != null) return _publishedContent; //need to get the URL for the page - _publishedContent = Current.UmbracoContext.ContentCache.GetById(_pageId); + _publishedContent = Current.UmbracoContext.Content.GetById(_pageId); return _publishedContent; } diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByIdRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByIdRouteHandler.cs index 304f59b64b..0ada310b12 100644 --- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByIdRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByIdRouteHandler.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.Mvc protected sealed override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext) { - var byId = umbracoContext.ContentCache.GetById(_realNodeId); + var byId = umbracoContext.Content.GetById(_realNodeId); return byId == null ? null : FindContent(requestContext, umbracoContext, byId); } diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 2fc449731d..2e8e532a58 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -237,7 +237,7 @@ namespace Umbraco.Web .And() .ManagedQuery(term); - return query.Execute().ToPublishedSearchResults(Current.UmbracoContext.ContentCache); + return query.Execute().ToPublishedSearchResults(Current.UmbracoContext.Content); } public static IEnumerable SearchChildren(this IPublishedContent content, string term, string indexName = null) @@ -258,7 +258,7 @@ namespace Umbraco.Web .And() .ManagedQuery(term); - return query.Execute().ToPublishedSearchResults(Current.UmbracoContext.ContentCache); + return query.Execute().ToPublishedSearchResults(Current.UmbracoContext.Content); } #endregion diff --git a/src/Umbraco.Web/Routing/AliasUrlProvider.cs b/src/Umbraco.Web/Routing/AliasUrlProvider.cs index f1c755191e..354c315202 100644 --- a/src/Umbraco.Web/Routing/AliasUrlProvider.cs +++ b/src/Umbraco.Web/Routing/AliasUrlProvider.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Routing /// public IEnumerable GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current) { - var node = umbracoContext.ContentCache.GetById(id); + var node = umbracoContext.Content.GetById(id); if (node == null) yield break; diff --git a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs index e5bb23bfce..4019b0e917 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs @@ -47,7 +47,7 @@ namespace Umbraco.Web.Routing while (pos > 1) { route = route.Substring(0, pos); - node = frequest.UmbracoContext.ContentCache.GetByRoute(route, culture: frequest?.Culture?.Name); + node = frequest.UmbracoContext.Content.GetByRoute(route, culture: frequest?.Culture?.Name); if (node != null) break; pos = route.LastIndexOf('/'); } @@ -71,7 +71,7 @@ namespace Umbraco.Web.Routing { _logger.Debug("Got id={ErrorNodeId}.", error404.Value); - content = frequest.UmbracoContext.ContentCache.GetById(error404.Value); + content = frequest.UmbracoContext.Content.GetById(error404.Value); _logger.Debug(content == null ? "Could not find content with that id." diff --git a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs index 8360ad7e38..8d2492f25c 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.Routing if (nodeId > 0) { _logger.Debug("Id={NodeId}", nodeId); - node = frequest.UmbracoContext.ContentCache.GetById(nodeId); + node = frequest.UmbracoContext.Content.GetById(nodeId); if (node != null) { diff --git a/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs b/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs index 54745b2529..70a920f6f0 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByPageIdQuery.cs @@ -14,7 +14,7 @@ int pageId; if (int.TryParse(frequest.UmbracoContext.HttpContext.Request["umbPageID"], out pageId)) { - var doc = frequest.UmbracoContext.ContentCache.GetById(pageId); + var doc = frequest.UmbracoContext.Content.GetById(pageId); if (doc != null) { diff --git a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs index d7b4c9925c..b8d7c0edd8 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Routing return false; } - var content = frequest.UmbracoContext.ContentCache.GetById(redirectUrl.ContentId); + var content = frequest.UmbracoContext.Content.GetById(redirectUrl.ContentId); var url = content == null ? "#" : content.Url(redirectUrl.Culture); if (url.StartsWith("#")) { diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs index 9aa52782d1..2dc665a00f 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs @@ -48,7 +48,7 @@ namespace Umbraco.Web.Routing Logger.Debug("Test route {Route}", route); - var node = docreq.UmbracoContext.ContentCache.GetByRoute(docreq.UmbracoContext.InPreviewMode, route, culture: docreq.Culture?.Name); + var node = docreq.UmbracoContext.Content.GetByRoute(docreq.UmbracoContext.InPreviewMode, route, culture: docreq.Culture?.Name); if (node != null) { docreq.PublishedContent = node; diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index 60124a96a2..ce75cf64f6 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.Routing if (frequest.Uri.AbsolutePath != "/") // no alias if "/" { - node = FindContentByAlias(frequest.UmbracoContext.ContentCache, + node = FindContentByAlias(frequest.UmbracoContext.Content, frequest.HasDomain ? frequest.Domain.ContentId : 0, frequest.Culture.Name, frequest.Uri.GetAbsolutePathDecoded()); diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index 842f855a0a..4e9944a808 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.Routing if (!current.IsAbsoluteUri) throw new ArgumentException("Current url must be absolute.", nameof(current)); // will not use cache if previewing - var route = umbracoContext.ContentCache.GetRouteById(content.Id, culture); + var route = umbracoContext.Content.GetRouteById(content.Id, culture); return GetUrlFromRoute(route, umbracoContext, content.Id, current, mode, culture); } @@ -78,7 +78,7 @@ namespace Umbraco.Web.Routing /// public virtual IEnumerable GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current) { - var node = umbracoContext.ContentCache.GetById(id); + var node = umbracoContext.Content.GetById(id); if (node == null) yield break; @@ -100,7 +100,7 @@ namespace Umbraco.Web.Routing var culture = d?.Culture?.Name; //although we are passing in culture here, if any node in this path is invariant, it ignores the culture anyways so this is ok - var route = umbracoContext.ContentCache.GetRouteById(id, culture); + var route = umbracoContext.Content.GetRouteById(id, culture); if (route == null) continue; //need to strip off the leading ID for the route if it exists (occurs if the route is for a node with a domain assigned) diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs index 2e772cb175..086fd589ab 100644 --- a/src/Umbraco.Web/Routing/PublishedRouter.cs +++ b/src/Umbraco.Web/Routing/PublishedRouter.cs @@ -517,7 +517,7 @@ namespace Umbraco.Web.Routing { // try and get the redirect node from a legacy integer ID valid = true; - internalRedirectNode = request.UmbracoContext.ContentCache.GetById(internalRedirectId); + internalRedirectNode = request.UmbracoContext.Content.GetById(internalRedirectId); } else { @@ -526,7 +526,7 @@ namespace Umbraco.Web.Routing { // try and get the redirect node from a UDI Guid valid = true; - internalRedirectNode = request.UmbracoContext.ContentCache.GetById(udiInternalRedirectId.Guid); + internalRedirectNode = request.UmbracoContext.Content.GetById(udiInternalRedirectId.Guid); } } diff --git a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs index 4f9086e50b..9c6459da62 100644 --- a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs +++ b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs @@ -164,7 +164,7 @@ namespace Umbraco.Web.Routing { if (LockedEvents) return; - var contentCache = Current.UmbracoContext.ContentCache; + var contentCache = Current.UmbracoContext.Content; foreach (var entity in args.PublishedEntities) { var entityContent = contentCache.GetById(entity.Id); @@ -210,7 +210,7 @@ namespace Umbraco.Web.Routing private static void CreateRedirect(int contentId, string culture, Guid contentKey, string oldRoute) { - var contentCache = Current.UmbracoContext.ContentCache; + var contentCache = Current.UmbracoContext.Content; var newRoute = contentCache.GetRouteById(contentId, culture); if (IsNotRoute(newRoute) || oldRoute == newRoute) return; var redirectUrlService = Current.Services.RedirectUrlService; diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index f40aa00b01..d34123c96c 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -70,8 +70,8 @@ namespace Umbraco.Web.Routing #region GetUrl private UrlMode GetMode(bool absolute) => absolute ? UrlMode.Absolute : Mode; - private IPublishedContent GetDocument(int id) => _umbracoContext.ContentCache.GetById(id); - private IPublishedContent GetDocument(Guid id) => _umbracoContext.ContentCache.GetById(id); + private IPublishedContent GetDocument(int id) => _umbracoContext.Content.GetById(id); + private IPublishedContent GetDocument(Guid id) => _umbracoContext.Content.GetById(id); /// /// Gets the url of a published content. diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index df711a084e..a7dcc6e422 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -49,7 +49,7 @@ namespace Umbraco.Web.Templates // terribly much for this implementation since we are just creating a doc content request to modify it's properties manually. var contentRequest = _publishedRouter.CreateRequest(_umbracoContextAccessor.UmbracoContext); - var doc = contentRequest.UmbracoContext.ContentCache.GetById(pageId); + var doc = contentRequest.UmbracoContext.Content.GetById(pageId); if (doc == null) { diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs index 0be392c6dd..7c66bf6505 100644 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ b/src/Umbraco.Web/Templates/TemplateUtilities.cs @@ -131,7 +131,7 @@ namespace Umbraco.Web.Templates public static string ResolveMediaFromTextString(string text) { // don't attempt to proceed without a context - if (Current.UmbracoContext == null || Current.UmbracoContext.MediaCache == null) + if (Current.UmbracoContext == null || Current.UmbracoContext.Media == null) { return text; } @@ -150,7 +150,7 @@ namespace Umbraco.Web.Templates { return match.Value; } - var media = Current.UmbracoContext.MediaCache.GetById(guidUdi.Guid); + var media = Current.UmbracoContext.Media.GetById(guidUdi.Guid); if(media == null) { // image does not exist - we could choose to remove the image entirely here (return empty string), diff --git a/src/Umbraco.Web/UmbracoComponentRenderer.cs b/src/Umbraco.Web/UmbracoComponentRenderer.cs index 25c2d78731..f6c3d30da3 100644 --- a/src/Umbraco.Web/UmbracoComponentRenderer.cs +++ b/src/Umbraco.Web/UmbracoComponentRenderer.cs @@ -92,7 +92,7 @@ namespace Umbraco.Web if (contentId == default) throw new ArgumentException("Invalid content id " + contentId); - var content = _umbracoContextAccessor.UmbracoContext.ContentCache?.GetById(true, contentId); + var content = _umbracoContextAccessor.UmbracoContext.Content?.GetById(true, contentId); if (content == null) throw new InvalidOperationException("Cannot render a macro, no content found by id " + contentId); diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs index 6a786ed6bf..c973fafa81 100644 --- a/src/Umbraco.Web/UmbracoInjectedModule.cs +++ b/src/Umbraco.Web/UmbracoInjectedModule.cs @@ -300,7 +300,7 @@ namespace Umbraco.Web // if yes, return true private bool EnsureHasContent(UmbracoContext context, HttpContextBase httpContext) { - if (context.ContentCache.HasContent()) + if (context.Content.HasContent()) return true; _logger.Warn("Umbraco has no content");