Interface IResult
- Namespace
- NuvTools.Common.ResultWrapper
- Assembly
- NuvTools.Common.dll
Defines the base contract for an operation result, representing the outcome of a business or system process along with contextual messages.
public interface IResult
- Extension Methods
Examples
Example usage:
IResult result = Result.Success("Operation completed successfully.");
if (!result.Succeeded)
{
logger.LogError(result.Message);
}
Remarks
This interface provides a consistent structure for handling success and error
results throughout the application.
Implementations usually include information such as:
- Whether the operation succeeded (Succeeded)
- The result classification (ResultType)
- Messages providing feedback or error details (Messages)
Properties
ContainsNotFound
Indicates whether the result represents a "Not Found" condition. Useful for distinguishing between empty results and missing resources.
bool ContainsNotFound { get; }
Property Value
Message
A simplified or aggregated version of the main message, typically derived from Title.
string? Message { get; }
Property Value
MessageDetail
The primary message detail, typically the first or most relevant message from the Messages collection.
MessageDetail? MessageDetail { get; }
Property Value
Messages
A collection of messages associated with the operation result. Each MessageDetail contains structured information about the outcome (e.g., warnings, validation errors, or success messages).
List<MessageDetail> Messages { get; }
Property Value
ResultType
Specifies the type or classification of the result, such as Success, Error, or ValidationError.
ResultType ResultType { get; }
Property Value
Succeeded
Indicates whether the operation completed successfully.
bool Succeeded { get; }