Files
Umbraco-CMS/src/Umbraco.Web/PublishedCache/NuCache/DataSource/PropertyData.cs

54 lines
1.6 KiB
C#

using System;
using System.ComponentModel;
using Newtonsoft.Json;
using Umbraco.Core.Serialization;
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
{
public class PropertyData
{
private string _culture;
private string _segment;
[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
}
[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
}
[JsonProperty("v")]
public object Value { get; set; }
//Legacy properties used to deserialize existing nucache db entries
[JsonProperty("culture")]
private string LegacyCulture
{
set => Culture = value;
}
[JsonProperty("seg")]
private string LegacySegment
{
set => Segment = value;
}
[JsonProperty("val")]
private object LegacyValue
{
set => Value = value;
}
}
}