KrzysKlein.ResultDotNet.AspNetCore 0.3.0

dotnet add package KrzysKlein.ResultDotNet.AspNetCore --version 0.3.0
                    
NuGet\Install-Package KrzysKlein.ResultDotNet.AspNetCore -Version 0.3.0
                    
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="KrzysKlein.ResultDotNet.AspNetCore" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KrzysKlein.ResultDotNet.AspNetCore" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="KrzysKlein.ResultDotNet.AspNetCore" />
                    
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 KrzysKlein.ResultDotNet.AspNetCore --version 0.3.0
                    
#r "nuget: KrzysKlein.ResultDotNet.AspNetCore, 0.3.0"
                    
#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 KrzysKlein.ResultDotNet.AspNetCore@0.3.0
                    
#: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=KrzysKlein.ResultDotNet.AspNetCore&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=KrzysKlein.ResultDotNet.AspNetCore&version=0.3.0
                    
Install as a Cake Tool

ResultDotNet.AspNetCore

Extensions for using the Result Pattern in ASP.NET Core applications.

Overview

ResultDotNet.AspNetCore provides helpers and extension methods to integrate the Result Pattern with ASP.NET Core, making it easier to handle errors, map results to HTTP responses, and compose functional pipelines in web APIs.

Installation

Add the package via NuGet:

# .NET CLI
 dotnet add package KrzysKlein.ResultDotNet.AspNetCore

Basic Usage

Mapping Results to HTTP Responses

public IActionResult MyAction()
{
    var result = SomeService.DoSomething();
    return result.ToActionResult();
}

Asynchronous Results

public async Task<IActionResult> MyAsyncAction()
{
    var result = await SomeService.DoSomethingAsync();
    return result.ToActionResult();
}

Custom Error Mapping

You can map errors to custom ProblemDetails or other response types using provided extension methods.

API Overview

  • ToActionResult(): Converts a Result<ProblemDetails>, or Result<TValue, ProblemDetails>, or ValueResult<ProblemDetails> or ValueResult<TValue, ProblemDetails> to an IActionResult.
  • Extensions for handling Task<Result<...>> or Task<ValueResult<...>> in async controller actions.
  • Helpers for mapping errors to ProblemDetails.

Examples

See examples for usage in real ASP.NET Core APIs.

License

MIT License

Product Compatible and additional computed target framework versions.
.NET 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 139 3/4/2026
0.2.2 131 2/26/2026
0.2.1 119 2/25/2026
0.1.0 127 2/18/2026