2017-07-20 11:21:28 +02:00
|
|
|
|
using System;
|
2015-01-27 19:47:30 +11:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
using System.Runtime.Serialization;
|
2018-01-15 11:32:30 +01:00
|
|
|
|
using Umbraco.Core.Models.Entities;
|
2015-01-27 19:47:30 +11:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
[DataContract(IsReference = true)]
|
2018-01-15 11:32:30 +01:00
|
|
|
|
public class PublicAccessRule : EntityBase
|
2015-01-27 19:47:30 +11:00
|
|
|
|
{
|
2015-01-28 13:16:50 +11:00
|
|
|
|
private string _ruleValue;
|
|
|
|
|
|
private string _ruleType;
|
2015-01-27 19:47:30 +11:00
|
|
|
|
|
|
|
|
|
|
public PublicAccessRule(Guid id, Guid accessEntryId)
|
|
|
|
|
|
{
|
|
|
|
|
|
AccessEntryId = accessEntryId;
|
|
|
|
|
|
Key = id;
|
2015-01-28 18:24:12 +11:00
|
|
|
|
Id = Key.GetHashCode();
|
2015-01-27 19:47:30 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public PublicAccessRule()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-06-21 18:11:03 +02:00
|
|
|
|
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
|
|
|
|
|
|
|
|
|
|
|
|
private class PropertySelectors
|
|
|
|
|
|
{
|
|
|
|
|
|
public readonly PropertyInfo RuleValueSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleValue);
|
|
|
|
|
|
public readonly PropertyInfo RuleTypeSelector = ExpressionHelper.GetPropertyInfo<PublicAccessRule, string>(x => x.RuleType);
|
|
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
|
2015-01-27 19:47:30 +11:00
|
|
|
|
public Guid AccessEntryId { get; internal set; }
|
|
|
|
|
|
|
2015-01-28 13:16:50 +11:00
|
|
|
|
public string RuleValue
|
2015-01-27 19:47:30 +11:00
|
|
|
|
{
|
2015-01-28 13:16:50 +11:00
|
|
|
|
get { return _ruleValue; }
|
2016-06-21 20:43:02 +02:00
|
|
|
|
set { SetPropertyValueAndDetectChanges(value, ref _ruleValue, Ps.Value.RuleValueSelector); }
|
2015-01-27 19:47:30 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-01-28 13:16:50 +11:00
|
|
|
|
public string RuleType
|
2015-01-27 19:47:30 +11:00
|
|
|
|
{
|
2015-01-28 13:16:50 +11:00
|
|
|
|
get { return _ruleType; }
|
2016-06-21 20:43:02 +02:00
|
|
|
|
set { SetPropertyValueAndDetectChanges(value, ref _ruleType, Ps.Value.RuleTypeSelector); }
|
2015-01-27 19:47:30 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-20 11:21:28 +02:00
|
|
|
|
|
2015-01-27 19:47:30 +11:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|