Files
Umbraco-CMS/src/Umbraco.Core/Models/KeyValue.cs

34 lines
892 B
C#
Raw Normal View History

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