diff --git a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs
index 4cc5b7e6a3..867e574abd 100644
--- a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs
+++ b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs
@@ -43,6 +43,7 @@ namespace Umbraco.Tests.PublishedContent
1
+
This is some content]]>
@@ -78,6 +79,38 @@ namespace Umbraco.Tests.PublishedContent
///
protected abstract dynamic GetDynamicNode(int id);
+ [Test]
+ public void Recursive_Property()
+ {
+ var doc = GetDynamicNode(1174);
+ var prop = doc.GetProperty("siteTitle", true);
+ Assert.IsNotNull(prop);
+ Assert.AreEqual("This is my site", prop.Value);
+ prop = doc.GetProperty("_siteTitle"); //test with underscore prefix
+ Assert.IsNotNull(prop);
+ Assert.AreEqual("This is my site", prop.Value);
+ Assert.AreEqual("This is my site", doc._siteTitle);
+ }
+
+ ///
+ /// Tests the internal instance level caching of returning properties
+ ///
+ ///
+ /// http://issues.umbraco.org/issue/U4-1824
+ /// http://issues.umbraco.org/issue/U4-1825
+ ///
+ [Test]
+ public void Can_Return_Property_And_Value()
+ {
+ var doc = GetDynamicNode(1173);
+
+ Assert.IsTrue(doc.HasProperty("umbracoUrlAlias"));
+ var prop = doc.GetProperty("umbracoUrlAlias");
+ Assert.IsNotNull(prop);
+ Assert.AreEqual("page2/alias, 2ndpagealias", prop.Value);
+ Assert.AreEqual("page2/alias, 2ndpagealias", doc.umbracoUrlAlias);
+ }
+
///
/// Tests the IsLast method with the result set from a Where statement
///
diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
index 9703358dd7..8176d340ab 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
@@ -81,6 +81,9 @@ namespace Umbraco.Tests.TestHelpers
FreezeResolution();
InitializeDatabase();
+
+ //ensure the configuration matches the current version for tests
+ SettingsForTests.ConfigurationStatus = UmbracoVersion.Current.ToString(3);
}
protected virtual void FreezeResolution()
diff --git a/src/Umbraco.Web/Models/DynamicPublishedContent.cs b/src/Umbraco.Web/Models/DynamicPublishedContent.cs
index 7f728d31e1..4eae00ff5f 100644
--- a/src/Umbraco.Web/Models/DynamicPublishedContent.cs
+++ b/src/Umbraco.Web/Models/DynamicPublishedContent.cs
@@ -656,7 +656,14 @@ namespace Umbraco.Web.Models
public IPublishedContentProperty GetProperty(string alias)
{
- return GetProperty(alias, false);
+ var prop = GetProperty(alias, false);
+ if (prop == null && alias.StartsWith("_"))
+ {
+ //if it is prefixed and the first result failed, try to get it by recursive
+ var recursiveAlias = alias.Substring(1, alias.Length - 1);
+ return GetProperty(recursiveAlias, true);
+ }
+ return prop;
}
public IPublishedContentProperty GetProperty(string alias, bool recursive)
{
diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs
index 6482e99014..13ac75f00c 100644
--- a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs
+++ b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs
@@ -1364,6 +1364,12 @@ namespace umbraco.MacroEngines
prop = n.GetProperty(alias);
}
}
+ if (prop == null && alias.StartsWith("_"))
+ {
+ //if the prop is still null but it starts with an _ then we'll check recursively
+ var recursiveAlias = alias.Substring(1, alias.Length - 1);
+ prop = n.GetProperty(recursiveAlias, true);
+ }
}
catch (Exception)
{