예제 #1
0
 public ModelErrors(ModelErrorInfo modelErrorInfo)
 {
     this.Errors = new List <ModelErrorInfo>();
     if (modelErrorInfo != null)
     {
         this.Errors.Add(modelErrorInfo);
     }
 }
예제 #2
0
 public static void AddErrorOrThrow(this ModelErrors errors, ModelErrorInfo modelErrorInfo, Func <string, Exception> generator = null)
 {
     if ((object)errors == null)
     {
         if (generator == null)
         {
             throw new ModelException(string.Empty, new ModelErrors(modelErrorInfo));
         }
         else
         {
             throw (generator(modelErrorInfo.ToString()));
         }
     }
     else
     {
         errors.Errors?.Add(modelErrorInfo);
     }
 }
예제 #3
0
        //public bool HasErrors() {
        //    if (this.Errors == null) {
        //        return false;
        //    }
        //    return (this.Errors.Count > 0);
        //}

        public void Add(ModelErrorInfo item)
        {
            this.Errors?.Add(item);
        }
예제 #4
0
 public static Exception Factory(ModelErrorInfo modelErrorInfo) => new ModelException(string.Empty, new ModelErrors(modelErrorInfo));
 public new static Exception Factory(ModelErrorInfo modelErrorInfo) => new ResolveNameNotUniqueException(string.Empty, new ModelErrors(modelErrorInfo));