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

52 lines
1.4 KiB
C#
Raw Normal View History

using System;
using System.ComponentModel;
using Newtonsoft.Json;
2017-12-07 13:22:32 +01:00
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
{
public class PropertyData
2017-12-07 13:22:32 +01:00
{
2018-05-08 11:06:07 +02:00
private string _culture;
private string _segment;
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "c")]
2018-05-08 11:06:07 +02:00
public string Culture
{
get => _culture;
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
[DefaultValue("")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, PropertyName = "s")]
2018-05-08 11:06:07 +02:00
public string Segment
{
get => _segment;
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
[JsonProperty("v")]
2017-12-07 13:22:32 +01:00
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;
}
2017-12-07 13:22:32 +01:00
}
2018-04-21 09:57:28 +02:00
}