Esempio n. 1
0
        public void Then(ISelfReferencingRule @ref, CapturedConstraint constraint)
        {
            BasicJsonRule basic = rule as BasicJsonRule;

            if (basic == null)
            {
                throw new InvalidOperationException("A self referencing rule (It) can only be used when a single field is used in the When clause.");
            }

            Then(basic.Selector, basic.Alias, constraint);
        }
Esempio n. 2
0
 public IFieldValidatorConfig Then(ISelfReferencingRule @ref, CapturedConstraint constraint)
 {
     try
     {
         CollectSingleSelectorVisitor visitor = rule.Accept(new CollectSingleSelectorVisitor());
         return(Then(visitor.SelectorPath, visitor.Alias, constraint));
     }
     catch (InvalidOperationException ex)
     {
         throw new InvalidOperationException("A self referencing rule (It) can only be used when a single field is used in the When clause.", ex);
     }
 }
Esempio n. 3
0
 public void For(ISelfReferencingRule selector, string alias = null)
 {
     try
     {
         CollectSingleSelectorVisitor visitor = rule.Accept(new CollectSingleSelectorVisitor());
         For(visitor.SelectorPath, alias);
     }
     catch (InvalidOperationException ex)
     {
         throw new InvalidOperationException("A self referencing rule (It) can only be used when a single field is used in the When clause.", ex);
     }
 }
Esempio n. 4
0
 public void ForEachIn(ISelfReferencingRule selector, string alias = null)
 {
     try
     {
         //TODO: A hack for now in order to force it as a MultiSelector.
         CollectSingleSelectorVisitor visitor = rule.Accept(new CollectSingleSelectorVisitor());
         ForEachIn(visitor.SelectorPath, alias);
     }
     catch (InvalidOperationException ex)
     {
         throw new InvalidOperationException("A self referencing rule (It) can only be used when a single field is used in the When clause.", ex);
     }
 }