Exemplo n.º 1
0
 public IRule GetRule(IRegisteredProperty r, Type attribute)
 {
     if (attribute == typeof(RequiredAttribute))
     {
         return(Required(r));
     }
     return(null);
 }
Exemplo n.º 2
0
        public virtual IPropertyValue ReadProperty(IRegisteredProperty registeredProperty)
        {
            if (fieldData.TryGetValue(registeredProperty.Index, out var fd))
            {
                return(fd);
            }

            return(null);
        }
Exemplo n.º 3
0
        public virtual PV ReadProperty <PV>(IRegisteredProperty <PV> registeredProperty)
        {
            if (!fieldData.TryGetValue(registeredProperty.Index, out var value))
            {
                return(default(PV));
            }

            IPropertyValue <PV> fd = value as IPropertyValue <PV> ?? throw new PropertyTypeMismatchException($"Property {registeredProperty.Name} is not type {typeof(PV).FullName}");

            return(fd.Value);
        }
Exemplo n.º 4
0
        public virtual void LoadProperty <PV>(IRegisteredProperty <PV> registeredProperty, PV newValue)
        {
            if (!fieldData.ContainsKey(registeredProperty.Index))
            {
                // TODO Destroy and Delink to old value
            }

            fieldData[registeredProperty.Index] = CreatePropertyValue(registeredProperty, newValue);

            SetParent(newValue);
        }
Exemplo n.º 5
0
 protected override IEditPropertyValue CreatePropertyValue <PV>(IRegisteredProperty <PV> registeredProperty, PV value)
 {
     return(Factory.CreateEditPropertyValue(registeredProperty, value));
 }
Exemplo n.º 6
0
 void IPropertyAccess.SetProperty <P>(IRegisteredProperty <P> registeredProperty, P value)
 {
     PropertyValueManager.SetProperty(registeredProperty, value);
 }
Exemplo n.º 7
0
 protected abstract P CreatePropertyValue <PV>(IRegisteredProperty <PV> registeredProperty, PV value);
Exemplo n.º 8
0
 protected virtual P ReadProperty <P>(IRegisteredProperty <P> property)
 {
     return(PropertyValueManager.ReadProperty <P>(property));
 }
Exemplo n.º 9
0
 protected void LoadProperty <P>(T target, IRegisteredProperty <P> registeredProperty, P value)
 {
     ToPropertyAccessor(target).LoadProperty(registeredProperty, value);
 }
Exemplo n.º 10
0
 protected P ReadProperty <P>(T target, IRegisteredProperty <P> registeredProperty)
 {
     return(ToPropertyAccessor(target).ReadProperty(registeredProperty));
 }
Exemplo n.º 11
0
 public IEditPropertyValue <P> CreateEditPropertyValue <P>(IRegisteredProperty <P> registeredProperty, P value)
 {
     return(new EditPropertyValue <P>(registeredProperty.Name, value));
 }
Exemplo n.º 12
0
 public IValidatePropertyValue <P> CreateValidatePropertyValue <P>(IRegisteredProperty <P> registeredProperty, P value)
 {
     return(new ValidatePropertyValue <P>(registeredProperty.Name, value));
 }
Exemplo n.º 13
0
 public ShortNameRule(IRegisteredProperty <string> shortName, IRegisteredProperty <string> firstName, IRegisteredProperty <string> lastName) : base(shortName, firstName, lastName)
 {
     this.shortName = shortName;
     this.firstName = firstName;
     this.lastName  = lastName;
 }
Exemplo n.º 14
0
 protected virtual void LoadProperty <P>(IRegisteredProperty <P> registeredProperty, P value)
 {
     PropertyValueManager.LoadProperty(registeredProperty, value);
 }
Exemplo n.º 15
0
 public RequiredRule(IRegisteredProperty registeredProperty) : base(registeredProperty)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Allows rule to get the meta properties (IsValid, IsModified)
 /// </summary>
 /// <param name="target"></param>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 protected IPropertyValue ReadPropertyValue(T target, IRegisteredProperty registeredProperty)
 {
     return(ToPropertyAccessor(target).ReadPropertyValue(registeredProperty));
 }
Exemplo n.º 17
0
 IPropertyValue IPropertyAccess.ReadPropertyValue(IRegisteredProperty registeredProperty)
 {
     return(PropertyValueManager.ReadProperty(registeredProperty));
 }