public ResultAppValue(TValue value, IEnumerable <IErrorApplication> errors, IErrorApplication errorNull = null) : this(errors) { Errors = value switch { null when errorNull != null => Errors.Concat(errorNull).ToList(), null => throw new ArgumentNullException(nameof(value)), _ => Errors }; Value = value; }
/// <summary> /// Преобразовать внутренний класс ошибок библиотеки в основной /// </summary> public static IErrorCommon ToErrorConverting(this IErrorApplication errorApplication) => ErrorApplicationConverter.ToErrorConverting(errorApplication);
/// <summary> /// Преобразовать коллекцию ответов в ответ с коллекцией /// </summary> public static IResultAppCollection <T> ToResultCollection <T>(this IResultAppValue <IEnumerable <T> > @this, IErrorApplication errorNull = null) => @this != null ? new ResultAppCollection <T>(@this.OkStatus ? @this.Value : @this.Value ?? Enumerable.Empty <T>(), @this.Errors, errorNull) : throw new ArgumentNullException(nameof(@this));
/// <summary> /// Преобразовать коллекцию ответов в ответ с коллекцией /// </summary> public static IResultAppCollection <T> ToResultCollection <T>(this IEnumerable <IResultAppCollection <T> > @this, IErrorApplication errorNull = null) => @this != null ? @this.Aggregate((IResultAppCollection <T>) new ResultAppCollection <T>(), (resultCollectionMain, resultCollection) => resultCollectionMain.ConcatResult(resultCollection)). WhereBad(result => result.Value.Count > 0, badFunc: result => errorNull != null ? new ResultAppCollection <T>(errorNull) : result) : throw new ArgumentNullException(nameof(@this));
public ResultApplication(IErrorApplication errorConverting) : this(errorConverting.AsEnumerable()) { }
public ResultAppValue(IErrorApplication error) : this(error.AsEnumerable()) { }
public ResultAppValue(TValue value, IErrorApplication errorNull = null) : this(value, Enumerable.Empty <IErrorApplication>(), errorNull) { }
/// <summary> /// Найти элементы в словаре штампа по ключам /// </summary> public IResultAppCollection <TElement> FindElementsInStamp <TElement>(IEnumerable <string> fieldsSearch, IErrorApplication errorNull) where TElement : IElementMicrostation => StampSubControls. ResultValueOk(subElements => FindElementsInFields <TElement>(subElements, fieldsSearch)). ToResultCollection(). ResultValueContinue(fields => fields.Count > 0, okFunc : fields => fields, badFunc : fields => errorNull). ToResultCollection();
/// <summary> /// Преобразовать внутренний класс ошибок библиотеки в основной /// </summary> public static IErrorCommon ToErrorConverting(IErrorApplication errorApplication) => (errorApplication != null) ? new ErrorCommon(ToFileConvertErrorType(errorApplication.ErrorMicrostationType), errorApplication.Description) : throw new ArgumentNullException(nameof(errorApplication));
public ResultAppCollection(IEnumerable <T> collection, IEnumerable <IErrorApplication> errors, IErrorApplication errorNull = null) : base(errors) { var collectionList = collection?.ToList(); Errors = collectionList switch { null when errorNull != null => Errors.Concat(errorNull).ToList(), null => throw new ArgumentNullException(nameof(collection)), _ => Errors }; Value = collectionList ?? new List <T>(); }
public ResultAppCollection(IEnumerable <T> collection, IErrorApplication errorNull = null) : this(collection, Enumerable.Empty <IErrorApplication>(), errorNull) { }
public ResultAppCollection(IErrorApplication error) : this(Enumerable.Empty <T>(), error.AsEnumerable()) { }