private static void fillFields(ValidationOptions options, IValidationNode node, IServiceLocator services, Accessor accessor)
        {
            var mode = node.DetermineMode(services, accessor);
            var field = new FieldOptions
            {
                field = accessor.Name,
                mode = mode.Mode
            };

            var graph = services.GetInstance<ValidationGraph>();
            var rules = graph.FieldRulesFor(accessor);
            var ruleOptions = new List<FieldRuleOptions>();

            rules.Each(rule =>
            {
                var ruleMode = rule.Mode ?? mode;
                ruleOptions.Add(new FieldRuleOptions
                {
                    rule = RuleAliases.AliasFor(rule),
                    mode = ruleMode.Mode
                });
            });

            field.rules = ruleOptions.ToArray();

            options._fields.Add(field);
        }
Exemplo n.º 2
0
 protected bool Equals(FieldOptions other)
 {
     return(string.Equals(field, other.field) && string.Equals(mode, other.mode) &&
            rules.SequenceEqual(other.rules));
 }
Exemplo n.º 3
0
		protected bool Equals(FieldOptions other)
		{
			return string.Equals(field, other.field) && string.Equals(mode, other.mode)
				&& rules.SequenceEqual(other.rules);
		}