Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldExists"/> class.
        /// </summary>
        /// <param name="primaryProperty">The primary property.</param>
        /// <param name="innerRule">The inner rule.</param>
        public FieldExists(IPropertyInfo primaryProperty, IBusinessRule innerRule)
            : base(primaryProperty)
        {
            if (InputProperties == null)
            {
                InputProperties = new List <IPropertyInfo>();
            }
            InputProperties.Add(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);
        }