2020-07-03 13:30:40 +10:00
|
|
|
|
using MessagePack;
|
|
|
|
|
|
using Newtonsoft.Json;
|
2018-04-24 01:31:01 +10:00
|
|
|
|
using System.Collections.Generic;
|
2020-07-03 13:30:40 +10:00
|
|
|
|
using System.Runtime.Serialization;
|
2018-12-13 15:08:12 +01:00
|
|
|
|
using Umbraco.Core.Serialization;
|
2018-04-24 01:31:01 +10:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The content item 1:M data that is serialized to JSON
|
|
|
|
|
|
/// </summary>
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataContract] // NOTE: Use DataContract annotations here to control how MessagePack serializes/deserializes the data to use INT keys
|
2020-07-01 17:19:56 +12:00
|
|
|
|
public class ContentNestedData
|
2018-04-24 01:31:01 +10:00
|
|
|
|
{
|
2020-07-03 13:30:40 +10:00
|
|
|
|
// TODO: We don't want to allocate empty arrays
|
2020-06-02 21:35:19 +12:00
|
|
|
|
//dont serialize empty properties
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 0)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("pd")]
|
2020-07-03 00:26:55 +10:00
|
|
|
|
[JsonConverter(typeof(AutoInterningStringKeyCaseInsensitiveDictionaryConverter<PropertyData[]>))]
|
2018-04-24 01:31:01 +10:00
|
|
|
|
public Dictionary<string, PropertyData[]> PropertyData { get; set; }
|
|
|
|
|
|
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 1)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("cd")]
|
2020-07-03 00:26:55 +10:00
|
|
|
|
[JsonConverter(typeof(AutoInterningStringKeyCaseInsensitiveDictionaryConverter<CultureVariation>))]
|
2018-04-24 01:31:01 +10:00
|
|
|
|
public Dictionary<string, CultureVariation> CultureData { get; set; }
|
2019-03-05 11:15:30 +01:00
|
|
|
|
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 2)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("us")]
|
2019-03-05 11:15:30 +01:00
|
|
|
|
public string UrlSegment { get; set; }
|
2020-06-02 21:35:19 +12:00
|
|
|
|
|
|
|
|
|
|
//Legacy properties used to deserialize existing nucache db entries
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 3)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("properties")]
|
|
|
|
|
|
[JsonConverter(typeof(CaseInsensitiveDictionaryConverter<PropertyData[]>))]
|
|
|
|
|
|
private Dictionary<string, PropertyData[]> LegacyPropertyData { set { PropertyData = value; } }
|
|
|
|
|
|
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 4)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("cultureData")]
|
|
|
|
|
|
[JsonConverter(typeof(CaseInsensitiveDictionaryConverter<CultureVariation>))]
|
|
|
|
|
|
private Dictionary<string, CultureVariation> LegacyCultureData { set { CultureData = value; } }
|
|
|
|
|
|
|
2020-07-03 13:30:40 +10:00
|
|
|
|
[DataMember(Order = 5)]
|
2020-06-02 21:35:19 +12:00
|
|
|
|
[JsonProperty("urlSegment")]
|
|
|
|
|
|
private string LegacyUrlSegment { set { UrlSegment = value; } }
|
2018-04-24 01:31:01 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|