protected virtual void ValidParameterCheck(FilterParameter parameter)
        {
            var results = new List <ValidationResult>();
            var context = new ValidationContext(parameter);

            if (!Validator.TryValidateObject(parameter, context, results, true))
            {
                string errorText = String.Empty;
                foreach (var error in results)
                {
                    errorText += (error.ErrorMessage + "\n");
                }
                throw new ArgumentException(errorText);
            }
        }
예제 #2
0
 public FilterParameterBuilder()
 {
     parameter = new FilterParameter();
 }
 public virtual void AddParameter(FilterParameter parameter)
 {
     ValidParameterCheck(parameter);
     Parameters.Add(parameter);
 }