Пример #1
0
        public AsyncPropertyValidator <TProp> SetValidator(IAsyncValidator <TProp> otherValidator)
        {
            if (otherValidator == null)
            {
                throw new ArgumentNullException(nameof(otherValidator));
            }
            if (otherValidator == this)
            {
                throw new ArgumentException("Detected circular reference");
            }

            if (ValidationTasks.Any(task => task.IsOtherValidator))
            {
                throw new InvalidOperationException("There is already set other validator");
            }

            ValidationTasks.Add(new ValidationTask(otherValidator, true));

            return(this);
        }
Пример #2
0
 public ValidateWorkflowAsyncStep(IAsyncValidator <TRequest> asyncValidator)
 {
     _asyncValidator = asyncValidator;
 }