public ModelErrors(ModelErrorInfo modelErrorInfo) { this.Errors = new List <ModelErrorInfo>(); if (modelErrorInfo != null) { this.Errors.Add(modelErrorInfo); } }
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); } }
//public bool HasErrors() { // if (this.Errors == null) { // return false; // } // return (this.Errors.Count > 0); //} public void Add(ModelErrorInfo item) { this.Errors?.Add(item); }
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));