Ejemplo n.º 1
0
        /// <summary>
        /// Validate entity dto
        /// </summary>
        /// <param name="entityDto">entity Dto</param>
        /// <returns></returns>
        protected void Validate(EntityDtoBase entityDto)
        {
            var errors = ValidationManager.Validate(entityDto);

            if (errors.Count != 0)
                throw new ValidationException(errors);
        }
Ejemplo n.º 2
0
        public List<ErrorInfo> Validate(EntityDtoBase dto)
        {
            if (_validators == null)
            {
                Init();
            }
            var dtoType = dto.GetType();
            // ReSharper disable once PossibleNullReferenceException
            if (_validators.ContainsKey(dtoType))
            {
                return _validators[dtoType].Validate(dto);
            }

            throw new ArgumentException(string.Format("Could not find validator for type={0}", dtoType));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Validates the specified activity dto.
 /// </summary>
 /// <param name="activityDto">The activity dto.</param>
 /// <returns>List of errors</returns>
 public abstract List<ErrorInfo> Validate(EntityDtoBase activityDto);