Exemple #1
0
        public IValidationContext <TOut> Handle(TRequestDto request)
        {
            //Log.Debug($"{this.GetType().Name} Handle Start");
            var validators = _scope.Resolve <IEnumerable <IValidator <TRequestDto> > >().ToList();

            foreach (var validator in validators)
            {
                var results = validator.Validate(request);
                if (!results.IsValid)
                {
                    results.Errors.ToList().ForEach(error => Context.AddMessage("E6", new[] { error.ErrorMessage }));
                }
            }
            //Log.Debug($"{this.GetType().Name} Handle End");
            return(Context);
        }