Pitasoft.Result 7.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Pitasoft.Result --version 7.0.1
                    
NuGet\Install-Package Pitasoft.Result -Version 7.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pitasoft.Result" Version="7.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pitasoft.Result" Version="7.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Pitasoft.Result" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pitasoft.Result --version 7.0.1
                    
#r "nuget: Pitasoft.Result, 7.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pitasoft.Result@7.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pitasoft.Result&version=7.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Pitasoft.Result&version=7.0.1
                    
Install as a Cake Tool

Pitasoft.Result

NuGet

Pitasoft.Result is a .NET library designed to standardize responses from REST services. It provides a set of classes to wrap data, status codes, and error collections, facilitating communication between APIs and clients.

Features

  • Standardized Responses: Use Result, ResultEntity<T>, and ResultEntities<T> to unify your API outputs.
  • Fluent Error Handling: Easily add errors or exceptions to your results using a fluent interface.
  • Status Management: Built-in StatusResult enum covering common API scenarios.
  • Batch Operations: Support for batch processing results with ResultBatch<T>.
  • Extensions: Helper methods to check for success, errors, or specific statuses.

Installation

dotnet add package Pitasoft.Result

Core Components

1. Simple Result

Used for operations that don't return data, only a status.

public Result DeleteUser(int id)
{
    if (id <= 0) return Result.ValidationError().AddError("id", "Invalid ID");
    // ... logic ...
    return Result.Ok();
}
2. Result with Entity

Used for operations returning a single object.

public ResultEntity<User> GetUser(int id)
{
    var user = _repository.Find(id);
    if (user == null) return ResultEntity<User>.NotExists();
    return ResultEntity<User>.Ok(user);
}
3. Result with Multiple Entities

Used for lists or paged results.

public ResultEntities<User> GetUsers(UserParameters params)
{
    var (users, total) = _repository.GetAll(params);
    return ResultEntities<User>.Ok(users, total);
}
4. Batch Result

Used for processing multiple items in a single request.

public ResultBatch<User> ImportUsers(List<User> users)
{
    var results = users.Select(u => Process(u)).ToList();
    return ResultBatch<User>.Ok(results);
}

Error Handling

The library supports a fluent API for adding errors:

return Result.ValidationError()
    .AddError("Email", "Invalid format")
    .AddError("Password", "Too short")
    .AddError(new Exception("Inner system error"));

Status Codes

The StatusResult enum includes:

  • Success: Ok, Added, Updated, Deleted.
  • Informational: NoExist, Warning.
  • Errors: ValidationError, DataError, DatabaseError, ConcurrencyError, ConnectionError, HttpError, Error, Unauthorized, Exception.

Extensions

Import Pitasoft.Result.Extensions to use:

  • result.IsSuccess(): True if status is Ok, Added, Updated, or Deleted.
  • result.IsError(): True for various error statuses.
  • result.IsNotExist(): True if status is NoExist.
  • result.HasErrors(): True if the Errors collection is not empty.

License

Copyright © 2019-2026 Pitasoft, S.L. Licensed under the LICENSE.txt provided in this repository.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Pitasoft.Result:

Package Downloads
Pitasoft.Client

.NET library designed to simplify the consumption of RESTful services. It provides a robust base class and helpers to handle HTTP requests, JSON serialization, and common API patterns.

Pitasoft.Web

Librerias basicas de aplicaciones web

Pitasoft.Blazor.Result

Application of the functionalities of the Pitasoft.Blazor package, adding functionalities of Pitasoft.Result.

Pitasoft.Mail

E-Mail server service.

Pitasoft.Result.AspNetCore

ASP.NET Core integration for Pitasoft.Result. Provides HTTP result mapping, JSON helpers, DI-based configuration, and exception handling for MVC and Minimal APIs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.4.1 182 4/19/2026
7.3.2 231 4/3/2026
7.3.1 369 3/26/2026
7.2.9 173 3/24/2026
7.2.8 152 3/23/2026
7.2.7 150 3/22/2026
7.2.6 182 3/20/2026
7.2.5 154 3/20/2026
7.2.4 221 3/13/2026
7.2.3 156 3/11/2026
7.2.2 178 3/10/2026
7.2.1 166 3/9/2026
7.1.4 205 3/2/2026
7.1.3 195 2/24/2026
7.1.2 161 2/24/2026
7.1.1 202 2/23/2026
7.0.2 188 2/12/2026
7.0.1 215 1/26/2026
6.5.7 405 5/27/2025
6.5.6 369 5/27/2025
Loading failed