diff --git a/src/Umbraco.Core/Models/Entities/DocumentEntitySlim.cs b/src/Umbraco.Core/Models/Entities/DocumentEntitySlim.cs
index 50bec85af1..5b63ad81c5 100644
--- a/src/Umbraco.Core/Models/Entities/DocumentEntitySlim.cs
+++ b/src/Umbraco.Core/Models/Entities/DocumentEntitySlim.cs
@@ -15,6 +15,8 @@ namespace Umbraco.Core.Models.Entities
set => _cultureNames = value;
}
+ public ContentVariation Variations { get; set; }
+
///
public bool Published { get; set; }
diff --git a/src/Umbraco.Core/Models/Entities/EntitySlim.cs b/src/Umbraco.Core/Models/Entities/EntitySlim.cs
index 7808cea19b..30f64e8da5 100644
--- a/src/Umbraco.Core/Models/Entities/EntitySlim.cs
+++ b/src/Umbraco.Core/Models/Entities/EntitySlim.cs
@@ -25,18 +25,7 @@ namespace Umbraco.Core.Models.Entities
/// Gets an entity representing "root".
///
public static readonly IEntitySlim Root = new EntitySlim { Path = "-1", Name = "root", HasChildren = true };
-
- ///
- /// Gets the AdditionalData key for culture names.
- ///
- public const string AdditionalCultureNames = "CultureNames";
-
- ///
- /// Gets the AdditionalData key for variations.
- ///
- public const string AdditionalVariations = "Variations";
-
-
+
// implement IEntity
///
diff --git a/src/Umbraco.Core/Models/Entities/IDocumentEntitySlim.cs b/src/Umbraco.Core/Models/Entities/IDocumentEntitySlim.cs
index 19d5b7ee68..6b72fd4a2b 100644
--- a/src/Umbraco.Core/Models/Entities/IDocumentEntitySlim.cs
+++ b/src/Umbraco.Core/Models/Entities/IDocumentEntitySlim.cs
@@ -10,6 +10,8 @@ namespace Umbraco.Core.Models.Entities
//fixme we need to supply more information than this and change this property name. This will need to include Published/Editor per variation since we need this information for the tree
IReadOnlyDictionary CultureNames { get; }
+ ContentVariation Variations { get; }
+
///
/// At least one variation is published
///
diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
index d9c0b8a35a..5b604eff3f 100644
--- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs
@@ -122,7 +122,7 @@ namespace Umbraco.Core.Models.PublishedContent
///
/// Gets culture infos for a culture.
///
- PublishedCultureInfos GetCulture(string culture = null);
+ PublishedCultureInfo GetCulture(string culture = null);
///
/// Gets culture infos.
@@ -132,7 +132,7 @@ namespace Umbraco.Core.Models.PublishedContent
/// the cultures that are published. For a draft content, those that are 'available' ie
/// have a non-empty content name.
///
- IReadOnlyDictionary Cultures { get; }
+ IReadOnlyDictionary Cultures { get; }
///
/// Gets the type of the content item (document, media...).
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
index dd3e7b6d9f..eb99401d39 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs
@@ -100,10 +100,10 @@ namespace Umbraco.Core.Models.PublishedContent
public virtual string GetUrl(string culture = null) => _content.GetUrl(culture);
///
- public PublishedCultureInfos GetCulture(string culture = null) => _content.GetCulture(culture);
+ public PublishedCultureInfo GetCulture(string culture = null) => _content.GetCulture(culture);
///
- public IReadOnlyDictionary Cultures => _content.Cultures;
+ public IReadOnlyDictionary Cultures => _content.Cultures;
///
public virtual PublishedItemType ItemType => _content.ItemType;
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedCultureInfos.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedCultureInfos.cs
index a93f94672a..a5669d1a9e 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedCultureInfos.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedCultureInfos.cs
@@ -6,12 +6,12 @@ namespace Umbraco.Core.Models.PublishedContent
///
/// Contains culture specific values for .
///
- public class PublishedCultureInfos
+ public class PublishedCultureInfo
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- public PublishedCultureInfos(string culture, string name, DateTime date)
+ public PublishedCultureInfo(string culture, string name, DateTime date)
{
if (string.IsNullOrWhiteSpace(culture)) throw new ArgumentNullOrEmptyException(nameof(culture));
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullOrEmptyException(nameof(name));
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs
index 5636b79064..8ed56b591a 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs
@@ -439,6 +439,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
///
private class ContentEntityDto : BaseDto
{
+ public ContentVariation Variations { get; set; }
+
[ResultColumn, Reference(ReferenceType.Many)]
public List VariationInfo { get; set; }
@@ -484,7 +486,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
public string Icon { get; set; }
public string Thumbnail { get; set; }
public bool IsContainer { get; set; }
- public ContentVariation Variations { get; set; }
+
// ReSharper restore UnusedAutoPropertyAccessor.Local
// ReSharper restore UnusedMember.Local
}
@@ -866,12 +868,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
entity.ContentTypeThumbnail = dto.Thumbnail;
}
- private static void BuildDocumentEntity(DocumentEntitySlim entity, BaseDto dto)
- {
- BuildContentEntity(entity, dto);
- entity.AdditionalData[EntitySlim.AdditionalVariations] = dto.Variations;
- }
-
private static EntitySlim BuildContentEntity(BaseDto dto)
{
// EntitySlim does not track changes
@@ -889,7 +885,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
// EntitySlim does not track changes
var entity = new DocumentEntitySlim();
- BuildDocumentEntity(entity, dto);
+ BuildContentEntity(entity, dto);
return entity;
}
@@ -902,7 +898,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
// EntitySlim does not track changes
var entity = new DocumentEntitySlim();
- BuildDocumentEntity(entity, dto);
+ BuildContentEntity(entity, dto);
//fixme we need to set these statuses for each variant, see notes in IDocumentEntitySlim
entity.Edited = dto.Edited;
@@ -918,7 +914,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
variantInfo[isoCode] = info.Name;
}
entity.CultureNames = variantInfo;
- entity.AdditionalData[EntitySlim.AdditionalCultureNames] = variantInfo;
+ entity.Variations = dto.Variations;
}
return entity;
}
diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs
index 0bc4fb9de4..920fa2acd5 100644
--- a/src/Umbraco.Tests/Published/NestedContentTests.cs
+++ b/src/Umbraco.Tests/Published/NestedContentTests.cs
@@ -273,8 +273,8 @@ namespace Umbraco.Tests.Published
public override int TemplateId { get; }
public override int SortOrder { get; }
public override string Name { get; }
- public override PublishedCultureInfos GetCulture(string culture = ".") => throw new NotSupportedException();
- public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public override PublishedCultureInfo GetCulture(string culture = ".") => throw new NotSupportedException();
+ public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
public override string UrlSegment { get; }
public override string WriterName { get; }
public override string CreatorName { get; }
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs
index 8244600994..6df92b13e7 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs
@@ -204,8 +204,8 @@ namespace Umbraco.Tests.PublishedContent
public int TemplateId { get; set; }
public int SortOrder { get; set; }
public string Name { get; set; }
- public PublishedCultureInfos GetCulture(string culture = null) => throw new NotSupportedException();
- public IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public PublishedCultureInfo GetCulture(string culture = null) => throw new NotSupportedException();
+ public IReadOnlyDictionary Cultures => throw new NotSupportedException();
public string UrlSegment { get; set; }
public string WriterName { get; set; }
public string CreatorName { get; set; }
diff --git a/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs b/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs
index e502097819..c5b27554c9 100644
--- a/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs
+++ b/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs
@@ -176,8 +176,8 @@ namespace Umbraco.Tests.PublishedContent
public int TemplateId { get; set; }
public int SortOrder { get; set; }
public string Name { get; set; }
- public PublishedCultureInfos GetCulture(string culture = null) => throw new NotSupportedException();
- public IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public PublishedCultureInfo GetCulture(string culture = null) => throw new NotSupportedException();
+ public IReadOnlyDictionary Cultures => throw new NotSupportedException();
public string UrlSegment { get; set; }
public string WriterName { get; set; }
public string CreatorName { get; set; }
diff --git a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs
index 46ff57c1f3..053705ca4d 100644
--- a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs
+++ b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs
@@ -7,7 +7,7 @@ namespace Umbraco.Tests.TestHelpers.Stubs
{
internal class TestPublishedContent : PublishedElement, IPublishedContent
{
- public TestPublishedContent(PublishedContentType contentType, int id, Guid key, Dictionary values, bool previewing, Dictionary cultures = null)
+ public TestPublishedContent(PublishedContentType contentType, int id, Guid key, Dictionary values, bool previewing, Dictionary cultures = null)
: base(contentType, key, values, previewing)
{
Id = id;
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.TestHelpers.Stubs
public int SortOrder { get; set; }
public string Name { get; set; }
public IVariationContextAccessor VariationContextAccessor { get; set; }
- public PublishedCultureInfos GetCulture(string culture = null)
+ public PublishedCultureInfo GetCulture(string culture = null)
{
// handle context culture
if (culture == null)
@@ -31,7 +31,7 @@ namespace Umbraco.Tests.TestHelpers.Stubs
// get
return Cultures.TryGetValue(culture, out var cultureInfos) ? cultureInfos : null;
}
- public IReadOnlyDictionary Cultures { get; set; }
+ public IReadOnlyDictionary Cultures { get; set; }
public string UrlSegment { get; set; }
public string DocumentTypeAlias => ContentType.Alias;
public int DocumentTypeId { get; set; }
diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs
index ffa72796a9..fbe0d930c6 100644
--- a/src/Umbraco.Web/Models/PublishedContentBase.cs
+++ b/src/Umbraco.Web/Models/PublishedContentBase.cs
@@ -133,10 +133,10 @@ namespace Umbraco.Web.Models
}
///
- public abstract PublishedCultureInfos GetCulture(string culture = null);
+ public abstract PublishedCultureInfo GetCulture(string culture = null);
///
- public abstract IReadOnlyDictionary Cultures { get; }
+ public abstract IReadOnlyDictionary Cultures { get; }
///
public abstract PublishedItemType ItemType { get; }
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
index d944c5f824..4ae94ad3c0 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs
@@ -235,12 +235,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
///
public override DateTime UpdateDate => _contentData.VersionDate;
- private IReadOnlyDictionary _cultureInfos;
+ private IReadOnlyDictionary _cultureInfos;
- private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary();
+ private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary();
///
- public override PublishedCultureInfos GetCulture(string culture = null)
+ public override PublishedCultureInfo GetCulture(string culture = null)
{
// handle context culture
if (culture == null)
@@ -254,7 +254,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
}
///
- public override IReadOnlyDictionary Cultures
+ public override IReadOnlyDictionary Cultures
{
get
{
@@ -266,7 +266,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
if (_contentData.CultureInfos == null)
throw new Exception("oops: _contentDate.CultureInfos is null.");
return _cultureInfos = _contentData.CultureInfos
- .ToDictionary(x => x.Key, x => new PublishedCultureInfos(x.Key, x.Value.Name, x.Value.Date));
+ .ToDictionary(x => x.Key, x => new PublishedCultureInfo(x.Key, x.Value.Name, x.Value.Date));
}
}
diff --git a/src/Umbraco.Web/PublishedCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/PublishedMember.cs
index 2064bf51ea..44ce2328b7 100644
--- a/src/Umbraco.Web/PublishedCache/PublishedMember.cs
+++ b/src/Umbraco.Web/PublishedCache/PublishedMember.cs
@@ -135,9 +135,9 @@ namespace Umbraco.Web.PublishedCache
public override string Name => _member.Name;
- public override PublishedCultureInfos GetCulture(string culture = null) => throw new NotSupportedException();
+ public override PublishedCultureInfo GetCulture(string culture = null) => throw new NotSupportedException();
- public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
public override string UrlSegment => throw new NotSupportedException();
diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs
index 5cd9dd0069..bc06779db7 100644
--- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs
+++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs
@@ -154,9 +154,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
public override string Name => _name;
- public override PublishedCultureInfos GetCulture(string culture = null) => throw new NotSupportedException();
+ public override PublishedCultureInfo GetCulture(string culture = null) => throw new NotSupportedException();
- public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
public override string UrlSegment => _urlName;
diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs
index 2535f61996..0690e3e6f6 100644
--- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs
+++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs
@@ -136,9 +136,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
}
- public override PublishedCultureInfos GetCulture(string culture = null) => throw new NotSupportedException();
+ public override PublishedCultureInfo GetCulture(string culture = null) => throw new NotSupportedException();
- public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
+ public override IReadOnlyDictionary Cultures => throw new NotSupportedException();
public override string WriterName
{
diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
index 8967fd5165..53d9df5505 100644
--- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
@@ -216,14 +216,14 @@ namespace Umbraco.Web.Trees
// set names according to variations
if (!culture.IsNullOrWhiteSpace())
foreach (var entity in result)
- EnsureName(entity, culture);
+ EnsureName((IDocumentEntitySlim)entity, culture);
return result;
}
// set name according to variations
//
- private void EnsureName(IEntitySlim entity, string culture)
+ private void EnsureName(IDocumentEntitySlim entity, string culture)
{
if (culture == null)
{
@@ -236,12 +236,8 @@ namespace Umbraco.Web.Trees
// for those items that DO support cultures, we need to get the proper name, IF it exists
// otherwise, invariant is fine
- if (entity.AdditionalData.TryGetValue(EntitySlim.AdditionalVariations, out var variationsObject) &&
- variationsObject is ContentVariation variations &&
- variations.Has(ContentVariation.CultureNeutral) &&
- entity.AdditionalData.TryGetValue(EntitySlim.AdditionalCultureNames, out var namesObject) &&
- namesObject is IDictionary names &&
- names.TryGetValue(culture, out var name) &&
+ if (entity.Variations.Has(ContentVariation.CultureNeutral) &&
+ entity.CultureNames.TryGetValue(culture, out var name) &&
!string.IsNullOrWhiteSpace(name))
{
entity.Name = name;
diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs
index c716e8ea46..2a2f125ece 100644
--- a/src/Umbraco.Web/umbraco.presentation/page.cs
+++ b/src/Umbraco.Web/umbraco.presentation/page.cs
@@ -393,10 +393,10 @@ namespace umbraco
private readonly PublishedContentType _contentType;
private readonly IPublishedProperty[] _properties;
private readonly IPublishedContent _parent;
- private IReadOnlyDictionary _cultureInfos;
+ private IReadOnlyDictionary _cultureInfos;
private readonly IVariationContextAccessor _variationContextAccessor;
- private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary();
+ private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary();
private PagePublishedContent(int id)
{
@@ -461,7 +461,7 @@ namespace umbraco
get { return _inner.Name; }
}
- public PublishedCultureInfos GetCulture(string culture = null)
+ public PublishedCultureInfo GetCulture(string culture = null)
{
// handle context culture
if (culture == null)
@@ -474,7 +474,7 @@ namespace umbraco
return Cultures.TryGetValue(culture, out var cultureInfos) ? cultureInfos : null;
}
- public IReadOnlyDictionary Cultures
+ public IReadOnlyDictionary Cultures
{
get
{
@@ -485,7 +485,7 @@ namespace umbraco
return _cultureInfos;
return _cultureInfos = _inner.PublishNames
- .ToDictionary(x => x.Key, x => new PublishedCultureInfos(x.Key, x.Value, _inner.GetCulturePublishDate(x.Key)));
+ .ToDictionary(x => x.Key, x => new PublishedCultureInfo(x.Key, x.Value, _inner.GetCulturePublishDate(x.Key)));
}
}