Table of Contents

Struct DeletionResult

Namespace
Olve.Results
Assembly
Olve.Results.dll

Represents the result of a deletion operation, which can succeed, fail due to not being found, or fail due to an error.

public readonly struct DeletionResult
Inherited Members
Extension Methods

Properties

Failed

Gets a value indicating whether the deletion failed.

public bool Failed { get; }

Property Value

bool

Problems

Gets the collection of problems associated with the result, if any.

public ResultProblemCollection? Problems { get; }

Property Value

ResultProblemCollection

Succeeded

Gets a value indicating whether the deletion succeeded.

public bool Succeeded { get; }

Property Value

bool

WasNotFound

Gets a value indicating whether the deletion failed due to the entity not being found.

public bool WasNotFound { get; }

Property Value

bool

Methods

Error(params IEnumerable<ResultProblem>)

Creates a deletion result representing failure due to an error.

public static DeletionResult Error(params IEnumerable<ResultProblem> problems)

Parameters

problems IEnumerable<ResultProblem>

The problems associated with the failure.

Returns

DeletionResult

A failure result.

NotFound()

Creates a deletion result representing failure due to the entity not being found.

public static DeletionResult NotFound()

Returns

DeletionResult

Success()

Creates a deletion result representing success.

public static DeletionResult Success()

Returns

DeletionResult

TryPickProblems(out ResultProblemCollection?)

Attempts to retrieve the problems associated with the result.

public bool TryPickProblems(out ResultProblemCollection? problems)

Parameters

problems ResultProblemCollection

When this method returns true, contains the problems. Otherwise, null.

Returns

bool

true if problems exist; otherwise, false.

Operators

implicit operator DeletionResult(ResultProblem)

Converts the specified problem to an error deletion result.

public static implicit operator DeletionResult(ResultProblem problem)

Parameters

problem ResultProblem

The problem to convert.

Returns

DeletionResult

An error deletion result.

implicit operator DeletionResult(ResultProblemCollection)

Converts the specified problems to an error deletion result.

public static implicit operator DeletionResult(ResultProblemCollection problems)

Parameters

problems ResultProblemCollection

The problems to convert.

Returns

DeletionResult

An error deletion result.