using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Collections;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
{
///
/// Represents a property.
///
[Serializable]
[DataContract(IsReference = true)]
public class Property : EntityBase
{
private List _values = new List();
private PropertyValue _pvalue;
private Dictionary _vvalues;
private static readonly Lazy Ps = new Lazy();
protected Property()
{ }
public Property(PropertyType propertyType)
{
PropertyType = propertyType;
}
public Property(int id, PropertyType propertyType)
{
Id = id;
PropertyType = propertyType;
}
public class PropertyValue
{
private string _culture;
private string _segment;
public string Culture
{
get => _culture;
internal set => _culture = value?.ToLowerInvariant();
}
public string Segment
{
get => _segment;
internal set => _segment = value?.ToLowerInvariant();
}
public object EditedValue { get; internal set; }
public object PublishedValue { get; internal set; }
public PropertyValue Clone()
=> new PropertyValue { _culture = _culture, _segment = _segment, PublishedValue = PublishedValue, EditedValue = EditedValue };
}
// ReSharper disable once ClassNeverInstantiated.Local
private class PropertySelectors
{
public readonly PropertyInfo ValuesSelector = ExpressionHelper.GetPropertyInfo(x => x.Values);
public readonly DelegateEqualityComparer