Table of Contents

Class EnsureAllExtensionsAsync

Namespace
Trellis
Assembly
Trellis.Results.dll

Provides asynchronous extension methods for EnsureAll validation accumulation on Result values.

public static class EnsureAllExtensionsAsync
Inheritance
EnsureAllExtensionsAsync
Inherited Members

Methods

EnsureAllAsync<TValue>(Task<Result<TValue>>, params (Func<TValue, bool> predicate, Error error)[])

Asynchronously runs all validation checks on the result value and accumulates any failures.

public static Task<Result<TValue>> EnsureAllAsync<TValue>(this Task<Result<TValue>> resultTask, params (Func<TValue, bool> predicate, Error error)[] checks)

Parameters

resultTask Task<Result<TValue>>

The task producing the result to validate.

checks (Func<TValue, bool> predicate, Error error)[]

The validation checks to run, each consisting of a predicate and an error to use if the predicate fails.

Returns

Task<Result<TValue>>

The original result if all checks pass; otherwise a failure with all accumulated errors.

Type Parameters

TValue

Type of the result value.

EnsureAllAsync<TValue>(ValueTask<Result<TValue>>, params (Func<TValue, bool> predicate, Error error)[])

Asynchronously runs all validation checks on the result value and accumulates any failures.

public static ValueTask<Result<TValue>> EnsureAllAsync<TValue>(this ValueTask<Result<TValue>> resultTask, params (Func<TValue, bool> predicate, Error error)[] checks)

Parameters

resultTask ValueTask<Result<TValue>>

The value task producing the result to validate.

checks (Func<TValue, bool> predicate, Error error)[]

The validation checks to run, each consisting of a predicate and an error to use if the predicate fails.

Returns

ValueTask<Result<TValue>>

The original result if all checks pass; otherwise a failure with all accumulated errors.

Type Parameters

TValue

Type of the result value.