/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Primary property.</param> /// <param name="expression">Regular expression.</param> public RegExMatch(Csla.Core.IPropertyInfo primaryProperty, string expression) : base(primaryProperty) { Expression = expression; RuleUri.AddQueryParameter("e", expression); InputProperties.Add(primaryProperty); }
/// <summary> /// Initializes a new instance of the <see cref="LessThanOrEqual"/> class. /// </summary> /// <param name="primaryProperty">The primary property.</param> /// <param name="compareToProperty">The compare to property.</param> public LessThanOrEqual(IPropertyInfo primaryProperty, IPropertyInfo compareToProperty) : base(primaryProperty) { CompareTo = compareToProperty; RuleUri.AddQueryParameter("compareto", compareToProperty.Name); InputProperties = new List <IPropertyInfo> { primaryProperty, compareToProperty }; }
public CalculateFractionRule(PropertyInfo <decimal> targetProperty, PropertyInfo <decimal> sourceProperty, decimal fraction) : base(targetProperty) { InputProperties.Add(sourceProperty); _sourceProperty = sourceProperty; _fraction = fraction; RuleUri.AddQueryParameter("fraction", fraction.ToString()); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Primary property for the rule.</param> /// <param name="dependencyProperties">Dependent property.</param> /// <remarks> /// When rules are run for one of the dependency properties the rules for primary property i rerun. /// </remarks> public DependencyFrom(Csla.Core.IPropertyInfo primaryProperty, params Csla.Core.IPropertyInfo[] dependencyProperties) : base(primaryProperty) { if (InputProperties == null) { InputProperties = new List <IPropertyInfo>(); } InputProperties.AddRange(dependencyProperties); RuleUri.AddQueryParameter("dependencyfrom", string.Join(",", dependencyProperties.Select(p => p.Name))); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="attribute">ValidationAttribute instance.</param> public DataAnnotation(Csla.Core.IPropertyInfo primaryProperty, System.ComponentModel.DataAnnotations.ValidationAttribute attribute) : base(primaryProperty) { this.Attribute = attribute; RuleUri.AddQueryParameter("a", attribute.GetType().FullName); if (primaryProperty != null) { InputProperties.Add(primaryProperty); } }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="min">Min value.</param> /// <param name="max">Max value.</param> public Range(IPropertyInfo primaryProperty, MIN min, MAX max) : base(primaryProperty) { Max = max; Min = min; RuleUri.AddQueryParameter("max", max.ToString()); RuleUri.AddQueryParameter("min", min.ToString()); InputProperties = new List <IPropertyInfo> { primaryProperty }; }
public CheckSumRule(PropertyInfo <int> value1Property, PropertyInfo <int> value2Property, int sumValue) : base(value1Property) { _sumValue = sumValue; InputProperties.Add(value1Property); InputProperties.Add(value2Property); _value1Property = value1Property; _value2Property = value2Property; RuleUri.AddQueryParameter("sumvalue", sumValue.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="IsNew"/> class. /// </summary> /// <param name="primaryProperty"> /// The primary property. /// </param> /// <param name="innerRule"> /// The inner rule. /// </param> public IsNew(IPropertyInfo primaryProperty, IBusinessRule innerRule) : base(primaryProperty) { InputProperties = new List <IPropertyInfo> { primaryProperty }; InnerRule = innerRule; RuleUri.AddQueryParameter("rule", System.Uri.EscapeUriString(InnerRule.RuleName)); // merge InnerRule input property list into this rule's list if (InnerRule.InputProperties != null) { InputProperties.AddRange(InnerRule.InputProperties); } // remove any duplicates InputProperties = new List <IPropertyInfo>(InputProperties.Distinct()); AffectedProperties.AddRange(innerRule.AffectedProperties); }