https://github.com/marcominerva/OperationResults
A set of lightweight libraries to totally decouple operation results and actual application responses.
https://github.com/marcominerva/OperationResults
controller csharp csharp-library hacktoberfest minimal-api net validation validation-library visual-studio web webapi
Last synced: 3 months ago
JSON representation
A set of lightweight libraries to totally decouple operation results and actual application responses.
- Host: GitHub
- URL: https://github.com/marcominerva/OperationResults
- Owner: marcominerva
- License: mit
- Created: 2022-09-09T12:44:36.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T10:13:58.000Z (9 months ago)
- Last Synced: 2024-10-30T17:24:45.283Z (8 months ago)
- Topics: controller, csharp, csharp-library, hacktoberfest, minimal-api, net, validation, validation-library, visual-studio, web, webapi
- Language: C#
- Homepage:
- Size: 165 KB
- Stars: 36
- Watchers: 7
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OperationResults
[](https://github.com/marcominerva/OperationResults/actions/workflows/linter.yml)
[](https://github.com/marcominerva/OperationResults/actions/workflows/codeql.yml)
[](https://github.com/marcominerva/OperationResultTools/blob/master/LICENSE)A set of lightweight libraries to totally decouple operation results and actual application responses.
## Core library
[](https://www.nuget.org/packages/OperationResultTools)
[](https://www.nuget.org/packages/OperationResultTools)**Installation**
The library is available on [NuGet](https://www.nuget.org/packages/OperationResultTools). Just search for *OperationResultTools* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
dotnet add package OperationResultTools
## ASP.NET Core integration library (Controller-based projects)
[](https://www.nuget.org/packages/OperationResultTools.AspNetCore)
[](https://www.nuget.org/packages/OperationResultTools.AspNetCore)_Note: This is the library to use if you're working with Controller._
This library provides HttpContext extension methods to automatically map Operation Results (that may come, for sample, from a business layer) to HTTP responses, along with the appropriate status codes.
A full sample is available in the [Sample folder](https://github.com/marcominerva/OperationResults/tree/master/samples). Search for the registration in the [Program.cs](https://github.com/marcominerva/OperationResults/blob/master/samples/Controllers/OperationResults.Sample/Program.cs#L24-L40) file and the usage in [Controllers folder](https://github.com/marcominerva/OperationResults/tree/master/samples/Controllers/OperationResults.Sample/Controllers).
**Installation**
The library is available on [NuGet](https://www.nuget.org/packages/OperationResultTools.AspNetCore). Just search for *OperationResultTools.AspNetCore* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
dotnet add package OperationResultTools.AspNetCore
## ASP.NET Core integration library (Minimal API projects)
[](https://www.nuget.org/packages/OperationResultTools.AspNetCore.Http)
[](https://www.nuget.org/packages/OperationResultTools.AspNetCore.Http)_Note: This is the library to use if you're working with Minimal APIs._
This library provides HttpContext extension methods to automatically map Operation Results (that may come, for sample, from a business layer) to HTTP responses, along with the appropriate status codes.
A full sample is available in the [Samples folder](https://github.com/marcominerva/OperationResults/tree/master/samples). Search for the [registration](https://github.com/marcominerva/OperationResults/blob/master/samples/MinimalApis/OperationResults.Sample/Program.cs#L23-L35) and the [usage](https://github.com/marcominerva/OperationResults/blob/master/samples/MinimalApis/OperationResults.Sample/Program.cs#L51-L106) in [Program.cs](https://github.com/marcominerva/OperationResults/blob/master/samples/MinimalApis/OperationResults.Sample/Program.cs) file.
**Installation**
The library is available on [NuGet](https://www.nuget.org/packages/OperationResultTools.AspNetCore.Http). Just search for *OperationResultTools.AspNetCore.Http* in the **Package Manager GUI** or run the following command in the **.NET CLI**:
dotnet add package OperationResultTools.AspNetCore.Http
**Contribute**
The project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests on the repo and we'll address them as we can.