Example #1
0
 public void Execute(ValidatingVisitor validator, TDefinition definition, IValidationLog log)
 {
     ArgumentUtility.CheckNotNull("validator", validator);
     ArgumentUtility.CheckNotNull("definition", definition);
     ArgumentUtility.CheckNotNull("log", log);
     RuleDelegate(new Args(validator, definition, log, this));
 }
Example #2
0
 private static void InstallDefaultRules(ValidatingVisitor visitor)
 {
     foreach (Type t in AssemblyTypeCache.GetTypes(Assembly.GetExecutingAssembly()))
     {
         if (!t.IsAbstract && typeof(IRuleSet).IsAssignableFrom(t) && t.Namespace == typeof(IRuleSet).Namespace)
         {
             IRuleSet ruleSet = (IRuleSet)Activator.CreateInstance(t);
             ruleSet.Install(visitor);
         }
     }
 }
Example #3
0
            public Args(ValidatingVisitor validator, TDefinition definition, IValidationLog log, DelegateValidationRule <TDefinition> self)
            {
                ArgumentUtility.CheckNotNull("validator", validator);
                ArgumentUtility.CheckNotNull("definition", definition);
                ArgumentUtility.CheckNotNull("log", log);
                ArgumentUtility.CheckNotNull("self", self);

                _validator  = validator;
                _self       = self;
                _log        = log;
                _definition = definition;
            }
Example #4
0
        private static ValidatingVisitor CreateValidatingVisitor(IValidationLog log, IRuleSet[] customRuleSets)
        {
            ValidatingVisitor visitor = new ValidatingVisitor(log);

            InstallDefaultRules(visitor);

            foreach (IRuleSet ruleSet in customRuleSets)
            {
                ruleSet.Install(visitor);
            }
            return(visitor);
        }