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