示例#1
0
        /// <summary>
        /// Invokes all rules for the business type.
        /// </summary>
        /// <returns>
        /// Returns a list of property names affected by the invoked rules.
        /// The PropertyChanged event should be raised for each affected
        /// property.
        /// </returns>
        public List <string> CheckRules()
        {
            if (_suppressRuleChecking)
            {
                return(new List <string>());
            }

            RunningRules = true;
            var affectedProperties = CheckObjectRules();
            var properties         = ((IManageProperties)Target).GetManagedProperties();

            foreach (var property in properties)
            {
                affectedProperties.AddRange(CheckRules(property));
            }
            RunningRules = false;
            if (!RunningRules && !RunningAsyncRules)
            {
                _target.AllRulesComplete();
            }
            return(affectedProperties.Distinct().ToList());
        }
示例#2
0
        /// <summary>
        /// Invokes all rules for the business type.
        /// </summary>
        /// <returns>
        /// Returns a list of property names affected by the invoked rules.
        /// The PropertyChanged event should be raised for each affected
        /// property.
        /// </returns>
        public List <string> CheckRules()
        {
            if (_suppressRuleChecking)
            {
                return(new List <string>());
            }

            RunningRules = true;
            var affectedProperties = CheckObjectRules(RuleContextModes.CheckRules, false);
            var properties         = TypeRules.Rules.Where(p => p.PrimaryProperty != null)
                                     .Select(p => p.PrimaryProperty)
                                     .Distinct();

            foreach (var property in properties)
            {
                affectedProperties.AddRange(CheckRules(property, RuleContextModes.CheckRules));
            }
            RunningRules = false;
            if (!RunningRules && !RunningAsyncRules)
            {
                _target.AllRulesComplete();
            }
            return(affectedProperties.Distinct().ToList());
        }