2020-06-02 21:35:19 +12:00
|
|
|
using System.ComponentModel;
|
2021-06-24 09:43:57 -06:00
|
|
|
using System.Runtime.Serialization;
|
2018-04-30 21:03:43 +02:00
|
|
|
using Newtonsoft.Json;
|
2021-06-24 09:43:57 -06:00
|
|
|
using Umbraco.Cms.Infrastructure.Serialization;
|
2017-12-07 13:22:32 +01:00
|
|
|
|
2022-06-20 09:21:08 +02:00
|
|
|
namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
|
|
|
|
|
|
|
|
|
|
[DataContract] // NOTE: Use DataContract annotations here to control how MessagePack serializes/deserializes the data to use INT keys
|
|
|
|
|
public class PropertyData
|
2017-12-07 13:22:32 +01:00
|
|
|
{
|
2022-06-20 09:21:08 +02:00
|
|
|
private string? _culture;
|
|
|
|
|
private string? _segment;
|
|
|
|
|
|
|
|
|
|
[DataMember(Order = 0)]
|
|
|
|
|
[JsonConverter(typeof(AutoInterningStringConverter))]
|
|
|
|
|
[DefaultValue("")]
|
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "c")]
|
|
|
|
|
public string? Culture
|
|
|
|
|
{
|
|
|
|
|
get => _culture;
|
|
|
|
|
set => _culture =
|
|
|
|
|
value ?? throw new ArgumentNullException(
|
|
|
|
|
nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DataMember(Order = 1)]
|
|
|
|
|
[JsonConverter(typeof(AutoInterningStringConverter))]
|
|
|
|
|
[DefaultValue("")]
|
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "s")]
|
|
|
|
|
public string? Segment
|
|
|
|
|
{
|
|
|
|
|
get => _segment;
|
|
|
|
|
set => _segment =
|
|
|
|
|
value ?? throw new ArgumentNullException(
|
|
|
|
|
nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DataMember(Order = 2)]
|
|
|
|
|
[JsonProperty("v")]
|
|
|
|
|
public object? Value { get; set; }
|
|
|
|
|
|
|
|
|
|
// Legacy properties used to deserialize existing nucache db entries
|
|
|
|
|
[IgnoreDataMember]
|
|
|
|
|
[JsonProperty("culture")]
|
|
|
|
|
private string LegacyCulture
|
|
|
|
|
{
|
|
|
|
|
set => Culture = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[IgnoreDataMember]
|
|
|
|
|
[JsonProperty("seg")]
|
|
|
|
|
private string LegacySegment
|
|
|
|
|
{
|
|
|
|
|
set => Segment = value;
|
|
|
|
|
}
|
2021-06-24 09:43:57 -06:00
|
|
|
|
2022-06-20 09:21:08 +02:00
|
|
|
[IgnoreDataMember]
|
|
|
|
|
[JsonProperty("val")]
|
|
|
|
|
private object LegacyValue
|
2017-12-07 13:22:32 +01:00
|
|
|
{
|
2022-06-20 09:21:08 +02:00
|
|
|
set => Value = value;
|
2017-12-07 13:22:32 +01:00
|
|
|
}
|
2018-04-21 09:57:28 +02:00
|
|
|
}
|