Pitasoft.Result
7.0.1
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
<PackageReference Include="Pitasoft.Result" Version="7.0.1" />
<PackageVersion Include="Pitasoft.Result" Version="7.0.1" />
<PackageReference Include="Pitasoft.Result" />
paket add Pitasoft.Result --version 7.0.1
#r "nuget: Pitasoft.Result, 7.0.1"
#:package Pitasoft.Result@7.0.1
#addin nuget:?package=Pitasoft.Result&version=7.0.1
#tool nuget:?package=Pitasoft.Result&version=7.0.1
Pitasoft.Result
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>, andResultEntities<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
StatusResultenum 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 theErrorscollection is not empty.
License
Copyright © 2019-2026 Pitasoft, S.L. Licensed under the LICENSE.txt provided in this repository.
| Product | Versions 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. |
-
net10.0
- Pitasoft.Error (>= 5.0.2)
-
net8.0
- Pitasoft.Error (>= 5.0.2)
-
net9.0
- Pitasoft.Error (>= 5.0.2)
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 |