Struct DeletionResult
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
Problems
Gets the collection of problems associated with the result, if any.
public ResultProblemCollection? Problems { get; }
Property Value
Succeeded
Gets a value indicating whether the deletion succeeded.
public bool Succeeded { get; }
Property Value
WasNotFound
Gets a value indicating whether the deletion failed due to the entity not being found.
public bool WasNotFound { get; }
Property Value
Methods
Error(params IEnumerable<ResultProblem>)
Creates a deletion result representing failure due to an error.
public static DeletionResult Error(params IEnumerable<ResultProblem> problems)
Parameters
problemsIEnumerable<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
Success()
Creates a deletion result representing success.
public static DeletionResult Success()
Returns
TryPickProblems(out ResultProblemCollection?)
Attempts to retrieve the problems associated with the result.
public bool TryPickProblems(out ResultProblemCollection? problems)
Parameters
problemsResultProblemCollectionWhen this method returns true, contains the problems. Otherwise, null.
Returns
Operators
implicit operator DeletionResult(ResultProblem)
Converts the specified problem to an error deletion result.
public static implicit operator DeletionResult(ResultProblem problem)
Parameters
problemResultProblemThe 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
problemsResultProblemCollectionThe problems to convert.
Returns
- DeletionResult
An error deletion result.