Ejemplo n.º 1
0
        protected override void MergeRules(IEnumerable <ValidationCollectorInfo> collectorGroup, List <IAddingComponentPropertyRule> collectedRules, ILogContext logContext)
        {
            var collectorInfos = collectorGroup.ToArray();

            //first: remove registered validator types for all collectors in same group (provider is responsible for order of collectors!)
            if (collectedRules.Any())
            {
                var registrationsWithContext   = GetValidatorRegistrationsWithContext(collectorInfos);
                var propertyValidatorExtractor = _propertyValidatorExtractorFactory.Create(registrationsWithContext, logContext);
                foreach (var validationRule in collectedRules)
                {
                    validationRule.ApplyRemoveValidatorRegistrations(propertyValidatorExtractor);
                }
            }

            //second: add new rules
            collectedRules.AddRange(collectorInfos.SelectMany(g => g.Collector.AddedPropertyRules));
        }