Table of Contents

Class DeletionResultExtensions

Namespace
Olve.Results
Assembly
Olve.Results.dll

Extension methods for DeletionResult.

public static class DeletionResultExtensions
Inheritance
DeletionResultExtensions
Inherited Members

Methods

MapToResult(DeletionResult, bool)

Converts a DeletionResult to a Result, optionally treating not-found as success.

public static Result MapToResult(this DeletionResult result, bool allowNotFound = true)

Parameters

result DeletionResult

The deletion result to convert.

allowNotFound bool

If true, not-found is treated as success. If false, not-found is treated as failure.

Returns

Result

A Result representing the outcome.

Match<T>(DeletionResult, Func<T>, Func<T>, Func<ResultProblemCollection, T>)

Exhaustively matches over the three states of a DeletionResult.

public static T Match<T>(this DeletionResult result, Func<T> onSuccess, Func<T> onNotFound, Func<ResultProblemCollection, T> onProblems)

Parameters

result DeletionResult

The deletion result to match.

onSuccess Func<T>

Called when the deletion succeeded.

onNotFound Func<T>

Called when the entity was not found.

onProblems Func<ResultProblemCollection, T>

Called when the deletion failed with problems.

Returns

T

The value produced by the matched handler.

Type Parameters

T

The return type.