2020-02-15 11:08:32 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Runtime.Serialization;
|
2021-02-18 11:06:02 +01:00
|
|
|
|
using Umbraco.Cms.Core.Models.Entities;
|
2020-02-15 11:08:32 +01:00
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Core.Models
|
2020-02-15 11:08:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Implements <see cref="IKeyValue"/>.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
[DataContract(IsReference = true)]
|
2020-03-28 14:55:03 +01:00
|
|
|
|
public class KeyValue : EntityBase, IKeyValue, IEntity
|
2020-02-15 11:08:32 +01:00
|
|
|
|
{
|
2022-02-24 14:39:29 +01:00
|
|
|
|
private string _identifier = null!;
|
2022-01-21 11:43:58 +01:00
|
|
|
|
private string? _value;
|
2020-02-15 11:08:32 +01:00
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2022-02-24 14:39:29 +01:00
|
|
|
|
public string Identifier
|
2020-02-15 11:08:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
get => _identifier;
|
2022-02-24 14:39:29 +01:00
|
|
|
|
set => SetPropertyValueAndDetectChanges(value, ref _identifier!, nameof(Identifier));
|
2020-02-15 11:08:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2022-01-21 11:43:58 +01:00
|
|
|
|
public string? Value
|
2020-02-15 11:08:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
get => _value;
|
|
|
|
|
|
set => SetPropertyValueAndDetectChanges(value, ref _value, nameof(Value));
|
|
|
|
|
|
}
|
2020-03-28 14:55:03 +01:00
|
|
|
|
|
|
|
|
|
|
bool IEntity.HasIdentity => !string.IsNullOrEmpty(Identifier);
|
2020-02-15 11:08:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|