public IRule GetRule(IRegisteredProperty r, Type attribute) { if (attribute == typeof(RequiredAttribute)) { return(Required(r)); } return(null); }
public virtual IPropertyValue ReadProperty(IRegisteredProperty registeredProperty) { if (fieldData.TryGetValue(registeredProperty.Index, out var fd)) { return(fd); } return(null); }
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); }
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); }
protected override IEditPropertyValue CreatePropertyValue <PV>(IRegisteredProperty <PV> registeredProperty, PV value) { return(Factory.CreateEditPropertyValue(registeredProperty, value)); }
void IPropertyAccess.SetProperty <P>(IRegisteredProperty <P> registeredProperty, P value) { PropertyValueManager.SetProperty(registeredProperty, value); }
protected abstract P CreatePropertyValue <PV>(IRegisteredProperty <PV> registeredProperty, PV value);
protected virtual P ReadProperty <P>(IRegisteredProperty <P> property) { return(PropertyValueManager.ReadProperty <P>(property)); }
protected void LoadProperty <P>(T target, IRegisteredProperty <P> registeredProperty, P value) { ToPropertyAccessor(target).LoadProperty(registeredProperty, value); }
protected P ReadProperty <P>(T target, IRegisteredProperty <P> registeredProperty) { return(ToPropertyAccessor(target).ReadProperty(registeredProperty)); }
public IEditPropertyValue <P> CreateEditPropertyValue <P>(IRegisteredProperty <P> registeredProperty, P value) { return(new EditPropertyValue <P>(registeredProperty.Name, value)); }
public IValidatePropertyValue <P> CreateValidatePropertyValue <P>(IRegisteredProperty <P> registeredProperty, P value) { return(new ValidatePropertyValue <P>(registeredProperty.Name, value)); }
public ShortNameRule(IRegisteredProperty <string> shortName, IRegisteredProperty <string> firstName, IRegisteredProperty <string> lastName) : base(shortName, firstName, lastName) { this.shortName = shortName; this.firstName = firstName; this.lastName = lastName; }
protected virtual void LoadProperty <P>(IRegisteredProperty <P> registeredProperty, P value) { PropertyValueManager.LoadProperty(registeredProperty, value); }
public RequiredRule(IRegisteredProperty registeredProperty) : base(registeredProperty) { }
/// <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)); }
IPropertyValue IPropertyAccess.ReadPropertyValue(IRegisteredProperty registeredProperty) { return(PropertyValueManager.ReadProperty(registeredProperty)); }