diff --git a/src/Umbraco.Core/Serialization/AutoInterningStringKeyCaseInsensitiveDictionaryConverter.cs b/src/Umbraco.Core/Serialization/AutoInterningStringKeyCaseInsensitiveDictionaryConverter.cs index 2076462f0c..f40b4b9f10 100644 --- a/src/Umbraco.Core/Serialization/AutoInterningStringKeyCaseInsensitiveDictionaryConverter.cs +++ b/src/Umbraco.Core/Serialization/AutoInterningStringKeyCaseInsensitiveDictionaryConverter.cs @@ -7,7 +7,7 @@ using Newtonsoft.Json.Converters; namespace Umbraco.Core.Serialization { /// - /// When applied to a dictionary with a string key, will ensure the deserialized string keys are interned + /// When applied to a dictionary with a string key, will ensure the deserialized string keys are interned /// /// /// @@ -26,7 +26,7 @@ namespace Umbraco.Core.Serialization { if (reader.TokenType == JsonToken.StartObject) { - var dictionary = new Dictionary(); + var dictionary = Create(objectType); while (reader.Read()) { switch (reader.TokenType) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/blockeditormodelobject.service.js b/src/Umbraco.Web.UI.Client/src/common/services/blockeditormodelobject.service.js index ccf6d395f6..cb06218618 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/blockeditormodelobject.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/blockeditormodelobject.service.js @@ -608,6 +608,12 @@ return null; } + // the Settings model has been changed to a new Element Type. + // we need to update the settingsData with the new Content Type key + if (settingsData.contentTypeKey !== settingsScaffold.contentTypeKey) { + settingsData.contentTypeKey = settingsScaffold.contentTypeKey; + } + blockObject.settingsData = settingsData; // make basics from scaffold diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentCacheDataModel.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentCacheDataModel.cs index 40acdfdb55..de49581730 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentCacheDataModel.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentCacheDataModel.cs @@ -17,11 +17,13 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource [DataMember(Order = 0)] [JsonProperty("pd")] [JsonConverter(typeof(AutoInterningStringKeyCaseInsensitiveDictionaryConverter))] + [MessagePackFormatter(typeof(MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter))] public Dictionary PropertyData { get; set; } [DataMember(Order = 1)] [JsonProperty("cd")] [JsonConverter(typeof(AutoInterningStringKeyCaseInsensitiveDictionaryConverter))] + [MessagePackFormatter(typeof(MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter))] public Dictionary CultureData { get; set; } [DataMember(Order = 2)] diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter.cs new file mode 100644 index 0000000000..24691497bc --- /dev/null +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using MessagePack; +using MessagePack.Formatters; + +namespace Umbraco.Web.PublishedCache.NuCache.DataSource +{ + /// + /// A messagepack formatter (deserializer) for a string key dictionary that uses OrdinalIgnoreCase for the key string comparison + /// + /// + public sealed class MessagePackAutoInterningStringKeyCaseInsensitiveDictionaryFormatter : DictionaryFormatterBase, Dictionary.Enumerator, Dictionary> + { + protected override void Add(Dictionary collection, int index, string key, TValue value, MessagePackSerializerOptions options) + { + string.Intern(key); + collection.Add(key, value); + } + + protected override Dictionary Complete(Dictionary intermediateCollection) + { + return intermediateCollection; + } + + + protected override Dictionary.Enumerator GetSourceEnumerator(Dictionary source) + { + return source.GetEnumerator(); + } + + protected override Dictionary Create(int count, MessagePackSerializerOptions options) + { + return new Dictionary(count, StringComparer.OrdinalIgnoreCase); + } + } +} + + + diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 2340228eae..5f6ab67a42 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -297,6 +297,7 @@ +