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); }
protected bool Equals(FieldOptions other) { return(string.Equals(field, other.field) && string.Equals(mode, other.mode) && rules.SequenceEqual(other.rules)); }
protected bool Equals(FieldOptions other) { return string.Equals(field, other.field) && string.Equals(mode, other.mode) && rules.SequenceEqual(other.rules); }